I installed python 3.6 using
brew install python3
and tried to download a file with six.moves.urllib.request.urlretrieve from an https, but it throws the error
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)
In the Python installation (from .pkg), the README indicates that one needs to run the Install Certificates.command after the installation to
- install
certifi - symlink the certification path to
certifypath
to be able to use certificates.
However, in brew install, this file does not exist and it does not seem to be run.
/Applications/Python\ 3.6/Install\ Certificates.commandin Terminal fixed this problem with my homebrew python3 installation.export SSL_CERT_DIR=/etc/ssl/certsworked for me in Mac OS Big Sur./opt/homebrew/etc/[email protected]/cert.pem. Now on a mac, you have that file in/private/etc/ssl/. So running,ln -s /private/etc/ssl/cert.pem /opt/homebrew/etc/[email protected]/cert.pemsym links the certificate. And, that resolved the issue.