删除重复的python安装后,Python要求在Mac上使用旧路径 [英] Python asks for older paths on mac after deleting duplicate python installation

查看:330
本文介绍了删除重复的python安装后,Python要求在Mac上使用旧路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过brew install python全新安装python后,出现以下错误.该链接属于以前手动删除的python安装.

I am having the below error after a clean installation of python via brew install python. The link belongs to a previous python installation which I deleted manually.

$ 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:

I am using MacOS 10.7.3 and I installed virtualenv via pip:

$ 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.

Edit : I reinstalled MacOSx and now returned back to my previous status that made me delete the preinstalled 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以某种方式错过了所有东西.

The virtualenv.py is located at /Library/Python/2.7/site-packages/virtualenv.py and /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/py2app/recipes/virtualenv.py but somehow python misses all.

为什么会有那么多混乱?我应该如何解决这个问题?

Why there is so much mess? How should I proceed to fix this?

推荐答案

在完成删除整个/System/Library/Frameworks/Python.framework/的愚蠢操作之后,我遇到了同样的情况 导致错误的原因:

I had the very same situation after done stupid thing of deleting whole /System/Library/Frameworks/Python.framework/ what results in error:

python: posix_spawn: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No such file or directory

我设法还原了它,因为我有整个磁盘的较早副本,并且只需将整个Python.framework目录复制粘贴回去.

I managed to restore it, because I had a earlier copy of my whole disk, and just by copy-pasting the whole Python.framework directory back.

我不知道它有多少取决于系统,但是如果有人想以同样的方式尝试这样做而不是重新安装整个OS X,那么从我这里压缩过来的整个Python.framework都在这里:

I don't know how much it is system dependent, but if somebody would like to try do that the same way instead of reinstalling whole OS X, the whole Python.framework zipped from me is here: http://andilabs.com/Python.framework.zip

这篇关于删除重复的python安装后,Python要求在Mac上使用旧路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆