tags:

views:

580

answers:

3

I recently upgraded to Mac OS 10.6 and didn't realise that it shipped with Python 2.6. I installed Python 2.5.4 and now it is the default Python installation. Can I uninstall Python 2.5.4 and keep 2.6?

+2  A: 

Use the uninstall utility of the same package manager you used to install it.

As a sidenote, you can just modify the PATH not to point to the 2.5.4 installation by default, and both can live happily side-by-side.

Eli Bendersky
can you tell me how to do that?
amit
which one? first tell use how you *installed* Python.
Eli Bendersky
python 2.6 was already installed. i installed python 2.5.4 through the dmg i downloaded form python.org. now i have 2 installations. help me get one off...the path change method also sounds feasible.
amit
interestingly, the path still points to python 2.6. but still when i type python at terminal, it launches python 2.5.4??
amit
There is no uninstaller for the python.org OS X python.
Ned Deily
Ned: looks like your answer is much more helpful here. amit, I hope it helps you achieve your goal
Eli Bendersky
A: 

Not only path but also link to python as it is now resolved as python2.5, not python2.6.

przemo_li
+1  A: 

While there is no uninstaller for the python.org OS X python installers (because they use the standard Apple installer mechanism which does not provide an uninstaller by default), it is not difficult to remove. I've documented the full process here but keep in mind that it doesn't hurt to have multiple python instances installed on OS X.

The key to managing it all is understanding where each instance is installed and how to manage your shell $PATH search order. By default, the python.org installers modify your .bash_profile (or .profile) shell initialization file to add the python framework bin directory at the front of your $PATH, that is, before /usr/bin where the Apple-supplied python command is found. You'll probably find the unmodified version saved as .bash_profile.pysave. Do a diff first to make sure there aren't any other changes and then just mv it back:

$ cd ~
$ diff .bash_profile{,.pysave}
12,16d11
< 
< # Setting PATH for MacPython 2.5
< # The orginal version is saved in .bash_profile.pysave
< PATH="/Library/Frameworks/Python.framework/Versions/2.5/bin:${PATH}"
< export PATH
$ mv .bash_profile.pysave .bash_profile

Start up a new terminal session and verify that python is again python2.6. (This assumes your default login shell is bash.)

If you want, you can then follow the instructions in the link above to actually remove all traces of the extra python. Note, do not attempt to remove the Apple-installed default python files in /usr/bin and /System/Library/Frameworks.

Ned Deily