No module named django.core when creating project in virtualenv

django, path, virtualenv

Solution

I solved this problem by using this command as following instead:

`django-admin startproject`

just remove the ".py" attached to "django-admin"

Problem

So I have looked around at a lot of questions similar to mine, however I couldn't find a concrete answer. My comp specifications are Windows 7 64-bit. My problem is as such: 1) I installed virtualenv using pip: ``` pip install virtualenv ``` 2) After that I created and activated a new environment: ``` path/virtualenv env ... path/to/env/Scripts/activate ``` 3) While running the new environment, I installed django: ``` (env) path/pip install django ``` 4) After installing successfully, I am ready to make a project. However, upon trying it out: ``` path/django-admin.py startproject test ``` I get the following error: ``` File "C:/path/env/Scripts/django-admin.py", line 2, in (module) from django.core import management ImportError: No module named django.core ``` I have tried out various solutions people have posted, including using the full path: ``` python C:/path/to/django-admin.py startproject test ``` I have also checked to make sure the versions of Python it is referencing are correct,as both inside and outside the virtualenv it is associated with Python27. Many other solutions talked about PYTHONPATH or the syspath, however, when I import django or managemnet in the python shell, those work fine. I have a feeling it may have something to do with the paths, but I'm not sure how a virtualenv interacts with the system paths. Since it is self-contained and the system paths are system wide, is it necessary to have something in the path specifically? As an aside, my django-admin.py file is in both ``` path/env/Scripts ``` and ``` path/env/Lib/site-packages/django/bin ``` and the django folder is in ``` path/env/Lib/site-packages ``` How to fix this problem?

Original source