<p>看起来你已经删除了苹果提供的Python2.7,它是OSX10.7的一部分。那是件坏事。您可能无意中损坏了依赖于它的OS X部分。一般来说,不要删除<code>/usr</code>(除了<code>/usr/local</code>)或<code>/System/Library</code>中的任何内容。如果您安装了某个更新版本的内容,请通过$PATH来管理,而不是通过删除。最好的长期做法是重新安装已删除的内容;最安全的方法是重新安装OS X。一个临时的解决方法可能是将<code>/usr/bin/python</code>移到一边,并用指向<code>/usr/local/bin/python2.7</code>的链接替换它,但您确实应该撤消对系统的损坏。</p>
<p>更新:现在您已经恢复了系统Python(很好!),我们可以查到你的原始版本。如果没有更多的信息,我只能推测,但可能是您将<code>virtualenv</code>安装到了错误的Python实例。请记住,需要在要使用的每个Python实例中安装提供<code>easy_install</code>命令的<code>Distribute</code>(或其前身<code>setuptools</code>)的副本,以及<code>pip</code>的单独副本。如果您使用苹果随OSX附带的<code>easy_install</code>,那么您将安装到苹果系统Python中。您提到在注释中使用<code>brew</code>。如果是这样,您应该遵循<a href="https://github.com/mxcl/homebrew/wiki/Homebrew-and-Python">the instructions and recipes for it</a>;这就是为什么您有一个包管理器。但以下是从零开始安装的方法:</p>
<pre><code>$ which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
$ curl -O http://python-distribute.org/distribute_setup.py
$ python distribute_setup.py
[...]
creating /Library/Frameworks/Python.framework/Versions/2.7.3_release_10.6/lib/python2.7/site-packages/distribute-0.6.26-py2.7.egg
Extracting distribute-0.6.26-py2.7.egg to /Library/Frameworks/Python.framework/Versions/2.7.3_release_10.6/lib/python2.7/site-packages
Adding distribute 0.6.26 to easy-install.pth file
Installing easy_install script to /Library/Frameworks/Python.framework/Versions/2.7/bin
Installing easy_install-2.7 script to /Library/Frameworks/Python.framework/Versions/2.7/bin
Installed /Library/Frameworks/Python.framework/Versions/2.7.3_release_10.6/lib/python2.7/site-packages/distribute-0.6.26-py2.7.egg
Processing dependencies for distribute==0.6.26
Finished processing dependencies for distribute==0.6.26
After install bootstrap.
Creating /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info
Creating /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools.pth
$ curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
$ python get-pip.py
$ which pip
/Library/Frameworks/Python.framework/Versions/2.7/bin/pip
$ pip install virtualenv
[...]
Installing virtualenv script to /Library/Frameworks/Python.framework/Versions/2.7/bin
Successfully installed virtualenv
Cleaning up...
$ which virtualenv
/Library/Frameworks/Python.framework/Versions/2.7/bin/virtualenv
$ virtualenv ENV
New python executable in ENV/bin/python
Installing setuptools............done.
Installing pip...............done.
$ source ENV/bin/activate
(ENV)$ which python
/Users/nad/ENV/bin/python
(ENV)$
</code></pre>