Ignore the Blueprint

A blog about programming, life and everything.

Cleaning Up Pythons on Your Mac


To do a clean Python install (and hopefuly remain that way), here's a brief guide.

Step 1: Remove all pip packages

pip uninstall -y -r <(pip freeze)

And also remove all pip caches:

rm -rf ~/Library/Caches/pip/*

Finally, remove pip:

pip uninstall pip

Step 2: Remove all Pythons

rm -rf ~/Library/Python
brew uninstall python

You might run into some error messages when you brew uninstall python, indicating that some packages relies on python so that python cannot to be uninstalled. In that case, delete them also.

Step 3: Clean up path

vim ~/.zshrc # or whatever shrc you are using.

Delete all python related path exports. And don't forget any anaconda / conda shit.

rm -rf ~/.anaconda*
rm -rf ~/anaconda*

Step 4: Install the one and only Python

brew install python

There you go, you now have a clean global python.