I'm looking for a way to cleanly uninstall all versions of python on OS X 10.10 except the default version that followed with the Mac. How do I proceed?
Currently I've some weird behaviour. When typing which -a python
I get the following output:
/Users/harisfawad/anaconda/bin/python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
/usr/local/bin/python
/usr/bin/python
Why doesn't the default version of python in /System/Library/.../
show up here? I can locate that version in Finder, so I know that it isn't deleted.
Also, echo $PYTHONPATH
returns an empty line.
Can I just go ahead and delete all these folders and expect the default version to run correctly?
I've read a similar inquiry here http://bugs.python.org/issue7107 but I'm not sure if this is still applicable to python versions 2.7/3.4.
This is also a similar question How to uninstall Python 2.7 on a Mac OS X 10.6.4? But again, I don't want to be careless and do the uninstalling before making sure that the system provided version works.
UPDATE: When running brew doctor
I get this Warning: "config" scripts exist outside your system or Homebrew directories.
And it goes on listing the "config" files in /.../anaconda/bin
and in /Library/.../bin
.
UPDATE2: I've successfully gone back to the default version of python that was included in OS X. All the above versions of python where moved to trash, except /usr/bin/python
. Thanks, @rhashimoto and @PadraicCunningham!
Open the terminal (bash or zsh) whatever shell you are using. Install python-3 using Homebrew (https://brew.sh). Look where it is installed. Change the default python symlink to the version you want to use from above.
The file /usr/bin/python
(and /usr/bin/pythonw
, which is a hard link to the same file) is actually a launcher program that invokes the default version of Python from /System/Library/Frameworks/Python.framework/Versions
. You can select the version (2.6 and 2.7 in Yosemite) the launcher invokes using either the defaults
command or the VERSIONER_PYTHON_VERSION
environment variable.
If you want to run a specific version manually, you can invoke /usr/bin/python2.6
or /usr/bin/python2.7
, which are symbolic links into /System/Library/Frameworks/Python.framework/Versions
.
You should be fine removing all other Python implementations you list from your path, including /Library/Frameworks/Python.framework/Versions/2.7/bin/python
(not sure how you got that one). It would still be wise to move them somewhere (e.g. your trash folder) to test your change before deleting them permanently.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With