gpt4 book ai didi

python - 没有名为 django.core 的模块

转载 作者:IT老高 更新时间:2023-10-28 21:39:13 27 4
gpt4 key购买 nike

卸载我的旧 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

最佳答案

我在 Windows 上遇到了同样的问题,我似乎找到了问题所在。我安装了 2.7 和 3.x。好像和.py的关联程序有关:

在命令行输入:

assoc .py

结果是:

.py=Python.文件

这意味着 .py 与 Python.File 相关联

然后我尝试了这个:

ftype Python.File

我明白了:

Python.File="C:\Python32\python.exe""%1"%*

这意味着在命令行中 .py 与我的 Python 3.2 安装相关联——这就是为什么我不能只键入“django-admin.py blah blah”来使用 django。

您需要做的就是更改关联:

ftype Python.File="C:\Python27\python.exe" "%1" %*

那么一切都好!

关于python - 没有名为 django.core 的模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/312549/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com