Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uninstall python.org version of python2.7 in favor of default OS X python2.7

I'm running OS X 10.8.2 and I believe that by default this comes with Python 2.7.3. I previously had Python 2.7.2 installed from python.org and would like to scrap it to basically reset my system's default python to that which comes pre-installed. The reason being that whenever I launch any *.py file IDLE refuses to open (even when specifying my installed Python2.7.2 IDLE) and I want to get things up to date.

Although I never use it, I do have MacPorts installed and I'm seeing that it did a bunch of stuff to my Python path - notably changing my Python 2.7 path to "/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}", so I don't know if this makes a difference.

Can anybody recommend a course of action here? I'm happy to provide additional information if needed.

like image 710
drodman Avatar asked Nov 24 '12 05:11

drodman


People also ask

Can I have 2 versions of Python installed?

Install multiple versions of Python. Install the latest development version of Python. Switch between the installed versions. Use virtual environments with pyenv.


1 Answers

There are three things making up the python.org python install which need to be removed. These steps worked for me:

  1. Remove the actual Python install:

    rm -rf /Library/Frameworks/Python.framework
    
  2. Remove the Python.org extra applications by deleting the folder at /Applications/Python 2.7:

    rm -rf /Applications/Python\ 2.7
    
  3. Remove the symlinks to the python executables from your /usr/local/bin directory:

    find /usr/local/bin -type l -and -lname "/Library/Frameworks/Python.framework*" -delete
    
  4. Remove or comment out these lines from your bash startup script (either ~/.profile or ~/.bash_profile):

    # Setting PATH for Python 2.7
    # The orginal version is saved in .profile.pysave
    PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
    export PATH
    

Some of these steps may require super-user privileges via e.g. sudo. Once this is done, you should have only the original Mac.

Based on documentation at http://docs.python.org/2/using/mac.html

like image 116
uayebforever Avatar answered Oct 05 '22 07:10

uayebforever