尝试使用 brewed python 安装 virtualenv 时,出现以下错误:
$ pip install virtualenv
Requirement already satisfied (use --upgrade to upgrade): \
virtualenv in /Library/Python/2.7/site-packages/virtualenv-1.9.1-py2.7.egg
Cleaning up...
很明显,pip 正在以某种方式查看系统 python 文件夹,而不是 /usr/local 中的 brewed 文件夹。我怎样才能避免这种情况?
brew医生没发现问题,路径优先级设置ok。
我试图从系统 python 中删除 virtualenv 包,所以我可以使用 brewed pip 安装 virtualenv。但是后来我无法创建 virtualenvs,因为我收到了这个错误:
$ virtualenv datatransfer/
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/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
working_set.require(__requires__)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: virtualenv==1.9.1
所以我没有设法避免系统virtualenv。
我做错了什么?