I have updated to latest Django version 1.0.2 after uninstalling my old Django version.But now when I run django-admin.py I get the following error. How can I resolve this?
Traceback (most recent call last): File "C:\Python25\Lib\site-packages\django\bin\django-admin.py", line 2, in <module> from django.core import management ImportError: No module named django.core
You must make sure that django is in your PYTHONPATH.
To test, just do a
import django from a python shell. There should be no output:
ActivePython 220.127.116.11 (ActiveState Software Inc.) based on Python 2.5.1 (r251:54863, May 1 2007, 17:47:05) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import django >>>
If you installed django via
easy_install, or with the
setup.py included with django), then check in your
site-packages if the
.pth file (
django.pth, ...) point to the correct folder.
I have the same problem on Windows and it seems I've found the problem. I have both 2.7 and 3.x installed. It seems it has something to do with the associate program of .py:
In commandline type:
and the result is:
which means .py is associated with Python.File
then I tried this:
Python.File="C:\Python32\python.exe" "%1" %*
which means in commandline .py is associated with my Python 3.2 installation -- and that's why I can't just type "django-admin.py blah blah" to use django.
ALL you need to do is change the association:
ftype Python.File="C:\Python27\python.exe" "%1" %*
then everythong's okay!