How to uninstall Python from Mac OS

There are two ways for installing Python on OS X/Mac, and they would affect how to uninstall python.
(1) “.pkg” from Python.org
(2) Installed through Homebrew
But sometimes we just got the wrong versions or we just want to remove the .pkg version of Python from your Mac ! Therefor, I wrote the solution down ! There will introduce two solutions of situation what I talked about !

Solution of Python.org version

Identify installation path

Check the python execution file exists in this path as below:
“/Library/Frameworks/Python.framework/Versions/3.5/bin/”
Note: You have to modify “Versions” to match the version of Python that you installed.

Step 1

Remove Python’s folders

Remove Python’s folders that installed by .pkg downloaded from Python.org.
If you are in the “Python.framework” right now, please change your directory before begin this step!

 

This instruction means removing all versions of Python.

 

Step 2

Remove “Applications” folder in OS X(Mac)

Now, we can remove the folders of Python from the “Applications”.
Note: Change the version of Python, if you need.

 

Step 3

Remove soft links

Remove these links are related to Python in “/usr/local/bin”.
Way 1: delete only one version

 

Way 2: delete all versions

 

Step 4

Restore settings in .bash_profile

This setting I will mention below may exist in two files: “~/.bash_profile” or “~/.profile

 

Let’s comment out this text in as below:
It contains the libraries path of Python!

 

Homebrew version

Remove Python

It’s the simplest way to manage your packages in OS X(Mac) !
First of all, lists what packages you install through Homebrew.
Instruction: “brew list”

 

Execute remove instruction “brew uninstall <package name>“.

Finished !
It’s so cool, isn’t it ?

 

Andy Wang

Non-stop learning and facing challenges.

One thought on “How to uninstall Python from Mac OS

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.