certificate verify failed: unable to get local issuer certificate

前端 未结 10 1306
梦如初夏
梦如初夏 2020-11-29 04:06

I am trying to get data from the web using python. I imported urllib.request package for it but while executing, I get error:

certificate verify failed: unab         


        
10条回答
  •  余生分开走
    2020-11-29 05:08

    For those who this problem persists: - Python 3.6 (some other versions too?) on MacOS comes with its own private copy of OpenSSL. That means the trust certificates in the system are no longer used as defaults by the Python ssl module. To fix that, you need to install a certifi package in your system.

    You may try to do it in two ways:

    1) Via PIP:

    pip install --upgrade certifi
    

    2) If it doesn't work, try to run a Cerificates.command that comes bundled with Python 3.6 for Mac:

    open /Applications/Python\ 3.6/Install\ Certificates.command
    

    One way or another, you should now have certificates installed, and Python should be able to connect via HTTPS without any issues.

    Hope this helped.

提交回复
热议问题