pip install Django on python3.6

22,901

Solution 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

Solution 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.

Solution 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.

Solution 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 ...

Solution 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

Share:
22,901
davideghz
Author by

davideghz

entrepreneurship, blues music and coding make my days brighter

Updated on July 05, 2022

Comments

  • davideghz
    davideghz almost 2 years

    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?

  • davideghz
    davideghz over 7 years
    I accept this answer because it was the first arrived and it precisely answer to my question. I read that using venv is a best practice thought :)
  • Essex
    Essex over 7 years
    Thank you, I will edit with venv. But as you don't mention it in your question, I didn't use it ;)