我从我的Ubuntu机器上卸载了Django 1.8,现在django-admin无法在Virtualenv内部工作,我应该重新安装Ubuntu吗?
例如,我试图在Virtualenv中创建一个项目
(django-1.4.3)to@tom-P34:~/project/django-1.4.3$ django-admin startproject he_tut
但是我收到了这个错误
Traceback (most recent call last):
File "/usr/local/bin/django-admin", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2749, in <module>
working_set = WorkingSet._build_master()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 446, in _build_master
return cls._build_from_requirements(__requires__)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 459, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 628, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: Django==1.8.dev20140602225050
所以我尝试在Virtualenv之外开始一个项目
(django-1.4.3)to@tom-P34:~/project/django-1.4.3$ deactivate
to@tom-P34:~/project/django-1.4.3$ cd ..
to@tom-P34:~/project$ django-admin startproject he_tut
我得到了与上面相同的错误。
虚拟环境有django 1.4.3,根系统根本没有Django,我使用的是python 2.7.6。
答案 0 :(得分:1)
您应该单独编写django-admin.py
而不是django-admin
:
django-admin.py startproject he_tut