BELLOUL GAYA BELLOUL GAYA - 1 year ago 121
Linux Question

install django in virtualenv python3.4 with linux os in virtualenv

I am getting this error when importing django inside python :

ImportError: No module named 'django'


I've got a problem when installing django in my web server aws, I made an
alias python = python3

so when I am working with python it is python 3.4 which is executing.
I made a virtual env with it, but when I install django even inside the virtual env, it is installing in the python 2.7 version, not in my virtualenv, and not with the python3 version.

does anyone knows how to make really my python3 as default or how I can install django in the correct folder (python3)

Answer Source

When you create a virtualenv, you need to show that you want to use python3. Do the following:

$ which python3
/usr/local/bin/python3

$ mkvirtualenv name --python=/usr/local/bin/python3

then try to install django:

$ pip install django

Hope it helps

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download