0

I have two versions of Python installed: 2.7 and 3.4. I installed Django 1.8 as recommended in the Django tutorial. However, it got installed in Python 2.7 instead of Python 3.4 so when I type import django in Python 3.4 I get the error message

 ImportError: No module named 'django'

If I type import django in Python 2.7 I get no errors.

Can anybody explain how I get Django 1.8 to be in the Python 3.4 path?

Zanna
  • 70,465
UbuntuDude
  • 45
  • 2
  • 7

1 Answers1

1

You can install django with pip3, which is an easy way.

Follow below to install pip3 and django:

  1. sudo apt-get update. Update your repositories to get the latest application versions available in your repositories.
  2. sudo apt-get install python3-pip. This will download pip3.
  3. sudo pip3 install django. This will download the latest global django version for python3.

  4. django-admin --version. Verify what version you got. I got 1.8.3, which you also should get. You can also verify which version you have like this:
    python3

    import django
    print(django.get_version())
    

Reference

Rickard B
  • 990