If I run pip install Django
I get
Requirement already satisfied: Django in /usr/local/lib/python2.7/dist-packages
I\'
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.
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
.
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
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
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 ..
.