Mac – Certificate issue with Python3 on OSX

certificatemacpythonssl

I've the same python issue as multiple users with OSX, that appears when I'm trying to access anything via https.

ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify
failed (_ssl.c:749)

I'm aware of the following solution (accepted response):
https://stackoverflow.com/questions/42098126/mac-osx-python-ssl-sslerror-ssl-certificate-verify-failed-certificate-verify.

But unfortunately, if I don't have a folder such as:

/Applications/Python 3.6/ReadMe.rtf

Hence I don't how to proceed.
Particularly when I've installed python3 I did it through using

brew install python3

I also tried to up the command

brew upgrade python3 

But it hasn't changed anything. Furthermore strange enough, according to brew now I have python 3.7.2.1 installed as it returns the following error if I try again to upgrade:

Tommasos-MBP:~ tommaso$ brew upgrade python3
Error: python3 3.7.2_1 already installed

But if I check the python3 version of my computer I get this.

Tommasos-MBP:~ tommaso$ python3 --version
Python 3.6.3

How should I proceed and why brew think that I've 3.7 installed while Python is still 3.6?

EDIT
If I run Brew doctor I get the following:

Warning: "config" scripts exist outside your system or Homebrew
directories. ./configure scripts often look for *-config scripts to
determine if software packages are installed, and what additional
flags to use when compiling and linking.

Having additional scripts in your path can confuse software installed
via Homebrew if the config script overrides a system or Homebrew
provided script of the same name. We found the following "config"
scripts:
/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6m-config
/Library/Frameworks/Python.framework/Versions/3.6/bin/python3-config
/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6-config

Warning: You have unlinked kegs in your Cellar Leaving kegs unlinked
can lead to build-trouble and cause brews that depend on those kegs to
fail to run properly once built. Run brew link on these: python
berkeley-db

Best Answer

You are running several versions of Python 3:

  • One installed via the official installer, into /Library/Frameworks/Python.framework/Versions/3.6/ and /Applications/Python 3.6 (3.6)
  • One through Homebrew via brew install python (3.7)

These may conflict. You only need one of them anyway. I'd recommend uninstalling the first one and working with Homebrew Python only. Then you can at least be sure where potential Python issues come from.

To perform the uninstallation, you have to remove the two folders, reload your shell. You may also have to remove symlinks that still point to this Python version, which you can find with:

ls -l /usr/local/bin | grep 'Python.framework/Versions/3.6' 

Then, run brew reinstall python.

Note that your new Python 3.7 version (through Homebrew) will live in /usr/local/bin/python3, so make sure your $PATH contains this directory, and that you call python3 when you want Homebrew's Python.

You may also choose to use python for the 3.7 version. In this case, please read the note about "unversioned symlinks" in brew info python.