Install Homebrew Python – Trustworthiness of Old References for Removing and Reinstalling Python on Mac

homebrewinstallmacospython

I'm new to the mac, and apparently I've made some sort of error. I've been learning python, via tutorials, and between Homebrew, Pip and XCode somehow my versions are all mixed. Pip3 points to python2, so all my python3 trials fail, etc…

I'm researching how to safely remove all versions and then shoot for a clean install (homebrew?) but I'm a bit nervous.

I've found some excellent links:

Clearly one doesn't touch anything in the root /system directory, and basically everything else gets deleted. What makes me nervous, is that this links are pretty doggone old. (six years! +) I'm not sure if I really trust them or not.

Anybody been here lately? Can I trust the postings linked above? How do I clean up this python version mess? Note: I'm using MacOS Sierra (10.12.5)

Best Answer

So, I ended up removing all python installations, and reinstalling things via Homebrew.

  1. which python ---> /Library/Frameworks/Python.framework/Versions/2.7/bin/python Delete the entire Python.framework directory from /Library/Frameworks.
  2. which python3 ---> /usr/local/bin/python3 Delete the entire python3 directory.
  3. I was a bit nervous about the symlinks. I initially renamed the ones that were obviously going to cause me trouble. It turns out that was unnecessary. Instead, just use:

    $ brew doctor
    Warning: Broken symlinks were found. Remove them with 'brew prune':
      /usr/local/bin/python-32
      /usr/local/bin/python2-32
      /usr/local/bin/python2.7-32
      /usr/local/bin/python2_DNU
      /usr/local/bin/python_DNU
      /usr/local/bin/pythonw-32
      /usr/local/bin/pythonw2-32
      /usr/local/bin/pythonw2.7-32
    

    So, brew prune (or brew cleanup --prune in newer versions of Homebrew) worked perfectly. It removed all of the above symlinks.

  4. Reinstall python and python3 via homebrew. All done.

At no time did I touch the python installation located within the /System folder.

Oh, and to be clear. The answer to the original question is

Yes, you can trust the old references, as written! That guidance is still valid.