嗨,我在用Python2.7奋斗了12个多小时,我当时在用Python3.7,所以出于某种原因我决定改成2.7,所以我卸载了3.7并安装了2.7,但是在激活虚拟环境后,我不能用这个错误启动一个项目。 我经历了所有的过程here,但我无法解决这个问题。 后来我尝试在虚拟环境之外安装django的奇怪的事情似乎很正常 但我认为这是不合适的帮助
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\cipher>pip install virtualenv
Collecting virtualenv
Installing collected packages: virtualenv
Successfully installed virtualenv-16.5.0
C:\Users\cipher>virtualenv market
New python executable in C:\Users\cipher\market\Scripts\python.exe
Installing setuptools, pip, wheel...
done.
C:\Users\cipher>cd market
C:\Users\cipher\market> .\Scripts\activate
(market) C:\Users\cipher\market>pip install django==1.5.4
Collecting django==1.5.4
Installing collected packages: django
Successfully installed django-1.5.4
(market) C:\Users\cipher\market>django-admin.py startproject market
Traceback (most recent call last):
File "C:\Users\cipher\market\Scripts\django-admin.py", line 2, in <module>
from django.core import management
ImportError: No module named django.core
(market) C:\Users\cipher\market>
即使您收到成功安装的消息,您也应该仔细检查是否确实如此(在从市场推出的pythonshell中,运行
import django
查看是否抛出了任何错误)。你可以试着重新安装它。如果安装没有问题,那么在使用.py文件的命令前面加上python
可能会有所帮助,如this page所示相关问题 更多 >
编程相关推荐