通过 brew install python 全新安装 python 后,我遇到以下错误。该链接属于我手动删除的以前的 python 安装。
$ virtualenv ENV
python: posix_spawn: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No such file or directory
我使用的是 MacOS 10.7.3,并通过 pip 安装了 virtualenv:
$ sudo /usr/local/share/python/pip install virtualenv
Downloading/unpacking virtualenv
Downloading virtualenv-1.7.1.2.tar.gz (2.1Mb): 2.1Mb downloaded
Running setup.py egg_info for package virtualenv
warning: no previously-included files matching '*.*' found under directory 'docs/_templates'
Installing collected packages: virtualenv
Running setup.py install for virtualenv
warning: no previously-included files matching '*.*' found under directory 'docs/_templates'
Installing virtualenv script to /usr/local/share/python
Successfully installed virtualenv
Cleaning up...
$ virtualenv ENV
python: posix_spawn: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No such file or directory
我怎样才能解决这个问题?
编辑:我重新安装了 MacOSx,现在又回到了我之前的状态,这让我删除了预安装的 python。
$ which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
$ which pip /usr/local/bin/pip $ sudo pip install virtualenv
Downloading/unpacking virtualenv
Downloading virtualenv-1.7.1.2.tar.gz (2.1Mb): 2.1Mb downloaded
Running setup.py egg_info for package virtualenv
warning: no previously-included files matching '*.*' found under directory 'docs/_templates'
Installing collected packages: virtualenv
Running setup.py install for virtualenv
warning: no previously-included files matching '*.*' found under directory 'docs/_templates'
Installing virtualenv script to /usr/local/bin
Successfully installed virtualenv
Cleaning up...
$ python virtualenv.py ENV
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'virtualenv.py': [Errno 2] No such file or directory
virtualenv.py 位于 /Library/Python/2.7/site-packages/virtualenv.py 和 /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/py2app/recipes/virtualenv.py但不知何故,python 错过了所有。
为什么会有这么多混乱?我应该如何着手解决这个问题?