尝试使用python3.4设置新的virtualenv时出现以下错误(我正在运行此命令: virtualenv -p / usr / bin / python / tmp / djangodev ):
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site- packages/pkg_resources.py", line 2697, in <module>
working_set.require(__requires__)
File "/System/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pkg_resources.py", line 669, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pkg_resources.py", line 576, in resolve
raise VersionConflict(dist,req) # XXX put more info here
pkg_resources.VersionConflict: (virtualenv 1.11.6 (/System/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages),
Requirement.parse('virtualenv==1.7.2'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 5, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pkg_resources.py", line 2701, in <module>
parse_requirements(__requires__), Environment()
File "/System/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pkg_resources.py", line 572, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: virtualenv==1.7.2
我首先下载了virtualenv1.7.2,并在收到此错误后通过运行更新它: pip install virtualenv 。以下是成功的安装消息:
Downloading/unpacking virtualenv
Downloading virtualenv-1.11.6-py2.py3-none-any.whl (1.6MB): 1.6MB downloaded
Installing collected packages: virtualenv
Successfully installed virtualenv
Cleaning up...
有人可以帮我解决上述错误吗?
答案 0 :(得分:2)
感谢@MattDMo让我知道。
我确实安装了多个virtualenv,因此我运行了sudo pip uninstall virtualenv
然后sudo pip install virtualenv
,这解决了上述错误。