mikebell.xyz


If you need a Computer Science tutor, code reviewer, or someone to pair program with, click here



Clean up and remove a Python3 homebrew install

description: tl;dr how to clean up and remove your Python3 homebrew install tags: python, python3, homebrew, macos


tl;dr TIL pygame is broken using homebrew Python3, so I decided to wipe my shit and start from scratch. I figured I’d give you the quickness on what I did so next time this shit happens to someone, they have a handy reference.

https://stackoverflow.com/questions/11248073/what-is-the-easiest-way-to-remove-all-packages-installed-by-pip

TIL about pip freeze:

freeze  Output installed packages in requirements format.

Save the requirements to file if you want to quickly re-install everything you’re about to remove.

pip3 freeze > requirements.txt
pip3 freeze | xargs pip3 uninstall -y

https://apple.stackexchange.com/questions/284824/remove-and-reinstall-python-on-mac-can-i-trust-these-old-references

rm -rfv /usr/local/bin/python3*

Ok, time to install official Python3.

At this point you can do pip3 install -r requirements.txt to reinstall everything you uninstalled. I’m keeping my stuff cleaner for now ^_^!


To reiterate:

pip3 freeze > requirements.txt
pip3 freeze | xargs pip3 uninstall -y
rm -rfv /usr/local/bin/python3*
# Reinstall python3 here!
pip3 install -r requirements.txt

If you need a Computer Science tutor, code reviewer, or just someone to pair program with, hit me up