How To Fix Python Error Certificate Verify Failed: Unable To Get Local Issuer Certificate In Mac OS

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.

  1. Open mac os finder, then click Applications —> Python 3.7 folder to expand it. Your python may has different version.
    macos-finder-applications-python3.7-Install Certificates command
  2. 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]
    
    
    
  3. Close the popup window when the command run complete successfully. Now run the python code again, the Certificate Verify Failed Error will disappear.
READ :   How To Make A Website With Python And Django

1 Comment


  1. In Readme text inside Python 3.7 it was informed that the certificates were not accepted of Firefox, the certificated “only” on 1024 Bytes, 2048 was requested. Downloaded the certificate, only program able to start opening it was PyCharm, but UTF8 was not correct format, as was not either other in the list, that I tried many of. Certificate text was unreadable.

    https://files.pythonhosted.org/packages/18/b0/8146a4f8dd402f60744fa380bc73ca47303cccf8b9190fd16a827281eac2/certifi-2019.9.11-py2.py3-none-any.whl

    Your advice I already had done. But the 1024 Bytes to 2048 Bytes issue seems not to have been solved. I believe the developer needs to solve it,
    and send out an update, or advice to download a new Python package.
    Btw I know zero about Python, programming, Mac or Linux, only logic.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.