Cleaning Up And Managing Python Versions On MacOSX

- 1 answer

Over time, I've managed to "accumulate" various versions of Python on my Mac. Most are there due to either being part of the OS, or being installed as part of another "solution" that has a dependency on Python. IN effect, I now have Python 2.6, 3.6 and 3.7 on my system, and it seems pip is somehow linked to 3.7, while pip3 is somehow linked to 3.6.

How can I safely remove all Python versions and only have the latest running and correctly "linked" with things like pip?

Perhaps I should have added the reason why I'm posting this question today, even though the "mess" with all the versions have been haunting me for a while now.

One of my scripts requires requests, and when I try to use it against an SSL URL, I get the infamous "ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:841)" error. No matter what I try (update/install certifi or running the Install Certificates.command) - my script keeps failing here and I suspect it simply because running the command or updating certifi is NOT changing the "running" python...



You can check out this Stack Overflow thread to help you locate/delete your python versions.

It is very common/normal to have multiple python versions on your system they just have to be setup correctly.

I would highly recommend using pyenv to manage multiple verions of python and it makes switching between them really easy (both locally and globally) and use it in combination with a virtual environment per project you are working on.