python - Mac OSX python ssl.SSLError : [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl. c:749)

标签 python macos ssl

python 中的许多操作都需要通过 https 访问。这包括 pip install,或仅使用 http.client.HTTPSConnection,或在内部使用这些东西的任何模块或应用程序。

如果python是从官方python pkg安装程序安装的,从https://python.org下载,然后它使用 openssl 的内部版本,并且不包含根证书。任何使用 SSL 连接都会导致此错误:

ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)

如何安装根证书以消除上述错误?

最佳答案

当您运行 python 安装程序时,它们会向您显示此信息。它也记录在 /Applications/Python 3.6/ReadMe.rtf 中,但很容易被忽略。

只需浏览到 Applications/Python 3.6 并双击 Install Certificates.command

Python 错误跟踪器中有一个关于此的问题。 http://bugs.python.org/issue29480

更新:此问题在错误跟踪器中标记为已解决,此文本是最新评论的一部分:

... For 3.7.0b2, I have tried to make things more obvious in two ways. One, the installer package will now attempt to open a Finder window for the /Application/Python 3.7 folder that contains the "Install Certificates.command". Two, rather than just a generic "installation complete" message at the end of the install, there is now a tailored message that urges the user to click on the "Install Certificates.command" icon. ...

关于python - Mac OSX python ssl.SSLError : [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl. c:749),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42098126/

相关文章:

python - Pybrain文本分类: data and input

c - 如何在 Mac 上从 C 访问 macOS API 调用?

objective-c - 如何从 OSX 10.9 中的 ProcessSerialNum 获取 PID?

ssl - Traefik:使用默认证书时日志中的 "No ACME certificate generation required for domains"

python - 无效的语法Python Inside打印2.7.11

python - 如何更改python中指针的位置?

python - 如何将嵌套数据示例中的两个值抽象到 pandas Dataframe 中?

c - GDB 和 Yosemite 的问题

java - 如何在新的(未弃用的)SSLSocketFactory 中加载私钥密码?

android - 如何在 Square MockWebServer 中使用 SSL?