Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I uninstall Python 2.5?

Tags:

python

macos

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?

like image 922
amit Avatar asked Sep 14 '26 05:09

amit


2 Answers

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.

like image 193
Ned Deily Avatar answered Sep 15 '26 20:09

Ned Deily


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.

like image 45
Eli Bendersky Avatar answered Sep 15 '26 19:09

Eli Bendersky



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!