No Module named django.core

2020-01-24 11:35发布

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

标签: python django
25条回答
叼着烟拽天下
2楼-- · 2020-01-24 12:04

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 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
>>>

If you installed django via setuptools (easy_install, or with the setup.py included with django), then check in your site-packages if the .pth file (easy-install.pth, django.pth, ...) point to the correct folder.

HIH.

查看更多
登录 后发表回答