在使用Homebrew安装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 doctor未发现任何问题,并且路径优先级设置正确。
我尝试从系统python中删除virtualenv包,以便使用brewed pip安装virtualenv。但是,我无法创建虚拟环境,因为出现了以下错误:
$ 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
所以我没有成功避免使用系统虚拟环境。
我做错了什么?
which python
和which pip
时会发生什么? - SethMMorton