Mac 下python3 [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed 解決方法


原文:http://blog.yuccn.net/archives/625.html

python3.6下使用urllib 的request進行url 請求時候,如果請求的是https,請求可以會出現
“urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)>”

錯誤棧(部分):

  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 544, in _open '_open', req) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 504, in _call_chain result = func(*args) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1361, in https_open context=self._context, check_hostname=self._check_hostname) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1320, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)> 

 

解決方案

進入應用程序的Python 3.6目錄,雙擊Install Certificates.command 進行安裝,完畢后可以解決該問題。

python certificate verify failed

(或者在命令行中輸入“/Applications/Python\ 3.6/Install\ Certificates.command”)

參考:
https://stackoverflow.com/questions/40684543/how-to-make-python-use-ca-certificates-from-mac-os-truststore


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM