English 中文(简体)
灰 Python在粉碎重复安装后,要求采用旧的 path。
原标题:Python asks for older paths on mac after deleting duplicate python installation

我在通过装饰板安装电灯后发现以下错误。 链接属于先前安装的假装,我人工删除。

$ 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安装了虚拟设备:

$ 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

我如何确定这一点?

Edit :我重述了MacOSx,现在又回到我先前的地位,使我删除了预定的 p。

$ 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

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.

为什么有这么多的东西? 我如何着手确定这一点?

最佳回答

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/Framework/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: 无此类档案或目录。

我得以恢复,因为我早有我的整个磁盘的拷贝,而只是复制整个沙里。 框架目录。

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

问题回答

它希望你删除了作为第10.7号行动的一部分的 Apple果-苏达·2.7。 这是错误的。 你可能无意中打破了视之而定的第十期特别协调员办事处的部分。 一般而言,从不删除<代码>/usr的任何内容。 (除<代码>/usr/ local外) 页: 1 如果你安装了更新版本的物品,则通过PATH管理,而不是删除。 最好的长期工作是重载您删除的内容;这样做的最安全方式是重新加入第十届非洲顾问会议。

UPDATE:既然你已恢复过沙尔系统(好!),我们就能够处理你最初的问题。 如果没有更多的信息,我只能猜测,但机会是,你正在安装“条码”(virtualenv<>/code>,以备受误。 铭记您需要安装<代码>Distribute(或其前身setuptools)的复印件,该文本提供easy_install<<>/code>的指令,以及pip在你希望使用的每一种情况下的单独拷贝。 如果您使用“easy_install,即有“OS X”的 Apple船,你将安装在“Amp”系统中。 请在评论中提及<条码>brew/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)$  




相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...