Pip install Django on python3.6

If I run pip install Django , I get

The requirement has already been met: Django in / usr / local / lib / python 2.7 / dist-packages

Instead, I want to use python3.6 (which is already installed in /usr/bin/python3.6 ). What is the correct pip syntax to install the latest version of Django on python 3.6?

+6
source share
5 answers

You need to install pip3:

 sudo apt-get install python3-pip 

Then you need to work with venv

 pip3 -p python3.6 virtualenv name 

And you need to write:

 pip3 install Django #or specific version pip3 install Django==1.10.5 
+6
source

If you have pip3 , then directly use

pip3 install Django

Try using virtualenv for your python version like:

pip -p python3.6 virtualenv name

then you can install any version of Django on it.

+3
source

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

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

Inside the virtual environment, pip will default to pip3 , which means python .

+2
source

As usual with these pip problems, before installing, check where pip points to pip -V .

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

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

+1
source

This means that you have already installed django in python2.7.

You can install django for python3 with:

 pip3 install Django 

You can also activate virtualenv and run pip install Django

0
source

Source: https://habr.com/ru/post/1013985/


All Articles