更改雪豹的python符号链接?

我在雪豹上安装了两个python 2.5.4安装程序,不要问为什么。

当我从cmdline运行“python”时,生成5363被启动。 当我运行/usr/bin/python2.5然后生成5646(我需要的)被启动。 在你问之前,编号并不是这些之间的唯一区别,而且也是编译的“types”,所以我真的不能用这个5363开始到某个地方。

问题是,我需要崩溃的应用程序(wxPython中的exception,不能谷歌那一个),我怀疑,当我启动与正确的Python构build主应用程序,线程开始与错误的一个相同的应用程序,在另一个系统)。

我如何去改变“默认”python2.5开始正确的构build?

我的path是:

 /Library/Frameworks/Python.framework/Versions/Current/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin 

which python只返回:

 /Library/Frameworks/Python.framework/Versions/Current/bin/python 

ls -la /usr/bin/python*返回:

 -rwxr-xr-x 2 root wheel 86000 Sep 25 2010 /usr/bin/python -rwxr-xr-x 5 root wheel 925 Sep 25 2010 /usr/bin/python-config lrwxr-xr-x 1 root wheel 75 Sep 25 2010 /usr/bin/python2.5 -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5 lrwxr-xr-x 1 root wheel 82 Sep 25 2010 /usr/bin/python2.5-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5-config lrwxr-xr-x 1 root wheel 75 Sep 25 2010 /usr/bin/python2.6 -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 lrwxr-xr-x 1 root wheel 82 Sep 25 2010 /usr/bin/python2.6-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6-config -rwxr-xr-x 2 root wheel 86000 Sep 25 2010 /usr/bin/pythonw lrwxr-xr-x 1 root wheel 76 Sep 25 2010 /usr/bin/pythonw2.5 -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw2.5 lrwxr-xr-x 1 root wheel 76 Sep 25 2010 /usr/bin/pythonw2.6 -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/pythonw2.6 

ls -la /usr/local/bin/python*返回:

 lrwxr-xr-x 1 root wheel 68 Apr 22 2010 /usr/local/bin/python -> ../../../Library/Frameworks/Python.framework/Versions/2.5/bin/python lrwxr-xr-x 1 root wheel 75 Apr 22 2010 /usr/local/bin/python-config -> ../../../Library/Frameworks/Python.framework/Versions/2.5/bin/python-config lrwxr-xr-x 1 root wheel 71 Apr 22 2010 /usr/local/bin/python2.5 -> ../../../Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5 lrwxr-xr-x 1 root wheel 78 Apr 22 2010 /usr/local/bin/python2.5-config -> ../../../Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5-config lrwxr-xr-x 1 root wheel 69 Apr 22 2010 /usr/local/bin/pythonw -> ../../../Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw lrwxr-xr-x 1 root wheel 72 Apr 22 2010 /usr/local/bin/pythonw2.5 -> ../../../Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw2.5 

我既不是python也不是* nix大师,把Mac添加到组合中,我觉得很无奈…

请帮忙!

在Mac OS X上安装多个相同版本的Python实例并不罕见。

看起来你可能从python.org安装了一个python2.5(这是在/usr/local/bin符号链接),但现在你只想使用苹果提供的系统Python 2.5(在/usr/bin )。 什么导致前者被发现是你的shell执行path。 /usr/local/bin/python实际上指向其中的一个文件

 /Library/Frameworks/Python.framework/Versions/Current/bin/ 

这是python.org安装的一部分。 默认情况下,python.org安装程序会修改你的shell启动文件,在你的path开始处插入这个目录。 要撤销这个,你可以恢复你的旧启动文件。 如果您使用的是默认的bash shell,则启动文件名为.bash_profile ,Python安装程序可能.bash_profile.pysave原始启动文件的副本保存为.bash_profile.pysave 。 从terminal会话,你可以检查和恢复原来的文件做这样的事情:

 $ cd $HOME $ ls .*.pysave .bash_profile.pysave .profile.pysave # # compare the current file to the original saved file # # You'll probably see something like the following: # $ diff .bash_profile .bash_profile.pysave 4c4 ---> # Setting PATH for MacPython 2.5 13c13 < PATH="/Library/Frameworks/Python.framework/Versions/2.5/bin:${PATH}" --- # # If so, it is safe to copy the saved file back and not lose # any other changes you might have made # $ cp -p .bash_profile.pysave .bash_profile # # Then you will need to start a new Terminal session to see the changed PATH 

如果您更喜欢或如果.pysave文件,您可以手动编辑文件以删除额外的目录。

保存你的头痛,并使用Pythonbrew来pipe理你的不同的Python版本。 不需要混淆符号链接等。 非常容易安装和使用。