卸载旧的Django版本后,我已经更新到最新的Django版本1.0.2。但是现在当我运行django-admin.py时,出现以下错误。我该如何解决?
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
您必须确保Django位于PYTHONPATH中。
要进行测试,只需import django在python shell中执行即可。应该没有输出:
import django
ActivePython 2.5.1.1 (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 >>>
如果你安装的Django通过setuptools(easy_install或与setup.py附带Django的),然后在您检查site- packages,如果.pth文件(easy-install.pth,django.pth,…)指向正确的文件夹。
setuptools
easy_install
setup.py
site- packages
.pth
easy-install.pth
django.pth
嗨。