django安装

2021-10-04  本文已影响0人  大唐游子

环境

window10 + WLS

django 安装

执行安装命令:python -m pip install Django

安装成功后出现以下警告:

  WARNING: The script sqlformat is installed in '/home/lcy/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script django-admin is installed in '/home/lcy/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

意思是django没有安装到PATH所在的路径中,需要将django的安装路径添加到PATH环境变量中。

打开~/.bashrc文件,在末尾添加:

export PATH=$PATH:/home/lcy/.local/bin

mysqlclient安装

要使数据库运行,需要安装数据库,如PostgreSQL, MariaDB, MySQL, OracleSQLite.

还需要安装Python的数据库客户端, 如mysqlclient :

linux下安装mysqlclient, 需要先安装一些依赖文件,再用pip安装mysqlcient即可(mysqlclient · PyPI):

Linux

Note that this is a basic step. I can not support complete step for build for all environment. If you can see some error, you should fix it by yourself, or ask for support in some user forum. Don't file a issue on the issue tracker.

You may need to install the Python 3 and MySQL development headers and libraries like so:

Then you can install mysqlclient via pip now:

$ pip install mysqlclient

参考

Quick install guide | Django documentation | Django (djangoproject.com)

How to install Django | Django documentation | Django (djangoproject.com)

mysqlclient · PyPI

上一篇 下一篇

猜你喜欢

热点阅读