我曾经使用 macport,最近改用 homebrew。使用 homebrew 安装的 python 版本清理所有 macports 环境后,我做了 pip install virtualenv。
$virtualenv test --no-site-packages
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 可用,这有点令人困惑
$virtualenv
virtualenv virtualenv-2.6
所以我卸载了我安装的东西,然后尝试重新安装:
Requirement already satisfied (use --upgrade to upgrade): virtualenv in /usr/local/lib/python2.7/site-packages
-bash: syntax error near unexpected token `('
我检查了 /usr/local/bin 中的结构如何:我认为这些 virtualenv 中的任何一个都不是符号链接:
-rwxr-xr-x 1 root wheel 276 Mar 12 2013 virtualenv
-rwxr-xr-x 1 root wheel 284 Mar 12 2013 virtualenv-2.6
如何删除所有 virtualenv,然后从头开始?