windows 为什么 django 给出错误:没有名为 django.core 的模块?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/843383/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why is django giving error: no module named django.core?
提问by mkelley33
I get the error in question when I attempt to create a project. I followed the instructions found at how to install python an django in windows vista.
当我尝试创建一个项目时,我收到了有问题的错误。我按照如何在 windows vista 中安装 python 和 django 中的说明进行操作。
采纳答案by Jason Baker
Also make sure that you have permission to access all of django's files. I've seen these kinds of errors happen because of permissions issues before.
还要确保您有权访问所有 django 文件。我以前见过由于权限问题而发生的这类错误。
EDIT: I haven't tried it out, but there's a link on that page to Instant Django, which looks like a pretty easy to set up.
编辑:我还没有尝试过,但该页面上有一个指向Instant Django的链接,看起来很容易设置。
回答by Niyaz
You can get around this problem by providing the full path to your django-admin.py file
您可以通过提供 django-admin.py 文件的完整路径来解决此问题
python c:\python25\scripts\django-admin.py startproject mysite
回答by user608629
From your command line (cmd
) run "ftype Python.File" and make sure that your .py files are being executed by the correct version/installation of Python.
从您的命令行 ( cmd
) 运行“ftype Python.File”并确保您的 .py 文件由正确的 Python 版本/安装执行。
It's possible another application has surreptitiously changed this under the hood.
另一个应用程序可能在幕后暗中改变了这一点。
回答by tghw
Most likely you don't have Django on your Python path. To test, quickly fire up Python and run:
很可能您的 Python 路径上没有 Django。要进行测试,请快速启动 Python 并运行:
>>> import django
If that fails, it's just a matter of getting Django onto your Python path. Either you set the environment variable, or you move django into your python2x/Lib/site-packages
directory. If it does work, try importing core
. If that fails there, then something is probably wrong with your Django install.
如果失败,只需将 Django 放到您的 Python 路径中即可。要么设置环境变量,要么将 django 移动到您的python2x/Lib/site-packages
目录中。如果确实有效,请尝试导入core
. 如果在那里失败,那么您的 Django 安装可能有问题。