pip install Django on python3.6

时间秒杀一切 提交于 2019-12-05 15:54:35

问题


If I run pip install Django I get

Requirement already satisfied: Django in /usr/local/lib/python2.7/dist-packages

I'd like to use python3.6 instead (which is already installed in /usr/bin/python3.6). What's the correct pip syntax to install the last version of Django on python 3.6?


回答1:


You have to install pip3 :

sudo apt-get install python3-pip

Then, you have to work with venv

pip3 -p python3.6 virtualenv name

And you have to write :

pip3 install Django

#or specific version
pip3 install Django==1.10.5



回答2:


If you have pip3 then directly use

pip3 install Django

Else try to use virtualenv for your python version as :

pip -p python3.6 virtualenv name

then you can install any version of Django on it.




回答3:


You can install it globally as others suggested, but the recommended way to install it is to use virtualenv or venv. In case you are using virtualenv (with virtualenvwrapper), just do

mkvirtualenv --python="path to python3 executable" "environment name"
pip install django

Inside virtual environment pip would be pip3 by default and so is python.




回答4:


As is common with these sort of pip issues, before you install, check where pip is pointing to with pip -V.

If that points to Python 2, you can then try pip3 -V; if that points to an older version of Python 3, go for pip3.6.

As a final approach, you can always go through python itself with python3.6 -m pip install ...




回答5:


It means you already installed django in python2.7.

You can install django for python3 via:

pip3 install Django

You can also activate virtualenv, and run pip install Django



来源:https://stackoverflow.com/questions/41588925/pip-install-django-on-python3-6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!