Mac OSX python ssl.SSLError:[SSL:CERTIFICATE_VERIFY_FAILED]证书验证失败(_ssl.c:749) [英] Mac OSX python ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)

查看:226
本文介绍了Mac OSX python ssl.SSLError:[SSL:CERTIFICATE_VERIFY_FAILED]证书验证失败(_ssl.c:749)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Python中的许多操作都需要通过https访问事物.这包括pip安装或仅使用http.client.HTTPSConnection或内部使用这些工具的任何模块或应用程序.

Many operations in python require accessing things via https. This includes pip install, or just using http.client.HTTPSConnection, or any modules or applications that use these things internally.

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

If python was installed from the official python pkg installer, downloaded from https://python.org, then it uses an internal version of openssl, and contains no root certificates. Anything that uses an SSL connection results in this error:

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

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

How can I install root certs to make the above error go away?

推荐答案

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

When you run the python installer, they display this information to you. It is also documented in /Applications/Python 3.6/ReadMe.rtf, but it's very easily overlooked.

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

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

There is an issue in the Python bug tracker about this. http://bugs.python.org/issue29480

更新:此问题在错误跟踪器中被标记为已解决,该注释为最新注释:

Update: This issue is marked as resolved in the bug tracker with this comment being the latest one:

对于3.7.0b2,我试图通过两种方式使事情变得更加明显.首先,安装程序包现在将尝试为/Application/Python 3.7文件夹打开一个包含"Install Certificates.command"的Finder窗口.在安装结束时,有两种消息,而不只是通用的安装完成"消息,现在有一条定制消息,敦促用户单击"Install Certificates.command"图标.

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.

这篇关于Mac OSX python ssl.SSLError:[SSL:CERTIFICATE_VERIFY_FAILED]证书验证失败(_ssl.c:749)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆