Virtualenvironment Ubuntu 12 ImportError: No module named django.core.management

19,127

Solution 1

Most likely, you have not installed django in the virtual environment.

  • Either install django in virtual environment. Activate the environment and then install django using pip or other methods.

  • Or link/copy django installed on the system (somewhere in /usr/lib/python-XXX) to python site packages in the environment. No recommended.

Solution 2

from the output of pip freeze you don't have Django installed in your virtual environment

run pip install django

Share:
19,127
Robin
Author by

Robin

Updated on June 05, 2022

Comments

  • Robin
    Robin almost 2 years

    I can create a project with django-admin.py startproject within a virtualenv. But when I try to run server with python manage.py runserver, I get an error:

    (check)robin@robin-VirtualBox:~/checking$ python manage.py runserver
    Traceback (most recent call last):
      File "manage.py", line 8, in <module>
        from django.core.management import execute_from_command_line
    ImportError: No module named django.core.management
    

    But I can run the server when I deactivate the environment and run the it from the project directory. Please help how to solve this. Thank you.

    (check)robin@robin-VirtualBox:~/checking$ pip freeze
    argparse==1.2.1
    wsgiref==0.1.2