Install Django1.8 for Python 3.4

542 Views Asked by At

I had Python 2.7 in my system by default, and I installed it and also installed Django 1.11 with it. Now I want to upgrade to a newer version of both and in order to do so, I accidentally deleted Django from usr/local/lib/python2.7. I'm not sure if the problem is because of this. Here are the errors that keep showing up:

  1. When I tried to remove the old version of Django:

    $ python -c "import django; print(django.__path__)"
    Traceback (most recent call last):
    File "<string>", line 1, in <module>
    ImportError: No module named 'django'
    
  2. When I check the Django version installed

    $ python3 -m django --version
    /usr/local/bin/python3: No module named django
    
  3. By doing pip freeze

    pip freeze
    Brlapi==0.6.1
    Django==1.8
    

I really want to learn Django, can you please help me with this installation?

1

There are 1 best solutions below

3
Riccardo Magliocchetti On

Installing with pip system wide is usually considered an anti pattern. You should really use virtualenv, you can a short introduction to virtualenv here: http://docs.python-guide.org/en/latest/dev/virtualenvs/

Back to your problem you seem to not know that python and python3 are two separated implementation, thus what you installed with one is not seen by other. Try anyway reinstalling django with

pip install --upgrade django

For python3 the related pip should be called something like pip3.