ImportError: Couldn’t import Django

I think the best way to use django is with virtualenv it’s safe and you can install many apps in virtualenv which does not affect any outer space of the system
vitualenv uses the default version of python which is same as in your system
to install virtualenv

sudo pip install virtualenv

or for python3

sudo pip3 install virtualenv

and then in your dir

mkdir ~/newproject

cd ~/newproject

Now, create a virtual environment within the project directory by typing

virtualenv newenv

To install packages into the isolated environment, you must activate it by typing:

source newenv/bin/activate

now install here with

pip install django

You can verify the installation by typing:

django-admin --version

To leave your virtual environment, you need to issue the deactivate command from anywhere on the system:

deactivate

Leave a Comment