When i run python code in mac os, i meet a certificate verify failed error like this ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056). This error confused me a lot of time. And after google the error, i finally find the solution to fix it, below is the steps.
1. Fix Python Certificate Verify Failed Error Steps.
- Open mac os finder, then click Applications —> Python 3.7 folder to expand it. Your python may has different version.
- Double click the Install Certificates.command file to run it. It will open another popup terminal window and show below command execution output text.
Last login: Mon Jun 24 15:53:52 on ttys002 /Applications/Python\ 3.7/Install\ Certificates.command ; exit; songs-MacBook-Pro:~ songzhao$ /Applications/Python\ 3.7/Install\ Certificates.command ; exit; -- pip install --upgrade certifi Requirement already up-to-date: certifi in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (2019.6.16) -- removing any existing file or link -- creating symlink to certifi certificate bundle -- setting permissions -- update complete logout Saving session... ...copying shared history... ...saving history...truncating history files... ...completed. [Process completed]
- Close the popup window when the command run complete successfully. Now run the python code again, the Certificate Verify Failed Error will disappear.