Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running django in virtualenv - ImportError: No module named django.core.management?

I have installed Django after activating my virtualenv but still I am getting following error

from django.core.management import execute_from_command_line
ImportError: No module named django.core.management
like image 270
shashisp Avatar asked Mar 08 '14 20:03

shashisp


3 Answers

You should check if django is installed Activate your environment, then run the following command to see which version is installed :

python -c "import django; print(django.get_version())"
like image 173
espern Avatar answered Oct 13 '22 13:10

espern


If you already activated your virtualenv (source /path/bin/activate) then check if you have installed Django.

pip install django

With next command you can see if Django was installed.

pip freeze | grep django

Another thing that you can try is to remove first line (#!/usr/bin/env python) in the manage.py file.

like image 27
P̲̳x͓L̳ Avatar answered Oct 13 '22 15:10

P̲̳x͓L̳


I am using virtual environment so I added this line in manage.py:

sys.path.append('./myvenv/lib/python3.5/site-packages')

in which myvenv is the name of my virtual environment and version of my installed Python is 3.5. This solved my issued.

like image 44
Mona Jalal Avatar answered Oct 13 '22 13:10

Mona Jalal