2

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...

Monty
  • 1,161
  • 2
  • 15
  • 26
  • If you run `type pip` or `type pip3` or `type python` or `type python3` it will tell you what it is actually running - i.e. whether it's an alias, or a **homebrew** package, or an Apple package. – Mark Setchell Jun 10 '19 at 08:56
  • pip, python and python 3 seems to all "link" nicely to my Anaconda installation, but pip3 seem to point to another framework - is there a way I can also "point" pip3 to Anaconda's version of Python? – Monty Jun 10 '19 at 08:58
  • Sorry, I don't use Anaconda and don't want to tell you anything incorrect. I think if you click `edit` under your question and add the output from all the various `type` commands I suggested, we will be half way to getting you a solution and someone else can hopefully help you with the other half :-) – Mark Setchell Jun 10 '19 at 09:01

1 Answers1

2

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.

Georges Lorré
  • 443
  • 3
  • 11
  • 1
    Management of virtual environments is nicely integrated into pyenv by the [pyenv-virtualenv plugin](https://github.com/pyenv/pyenv-virtualenv). – Robert Jun 10 '19 at 10:50
  • So I've tried installing pyenv now, but I just get more confused with all the commands and it seems that I'd almost be better off with wiping ALL traces of Python ( except the stuff that came with MacOS), and restart with a clean install of Anaconda, since the UI seems intuitive to me. Still trying to follow the suggested thread above to try and remove older/other versions without killing my machine... – Monty Jun 10 '19 at 11:08
  • OK, removed all my "user" environments, and seems to be "better" now - my root issue of the requests complaining about certificates I've solved by adding the verify=False flag to the requests call. – Monty Jun 10 '19 at 13:07