CERTIFICATE_VERIFY_FAILED Python 3.6 mac osx 无法使用“Install Certificates.command"修复 [英] CERTIFICATE_VERIFY_FAILED Python 3.6 mac osx can't fix with 'Install Certificates.command'

查看:160
本文介绍了CERTIFICATE_VERIFY_FAILED Python 3.6 mac osx 无法使用“Install Certificates.command"修复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

知道更新在 Python 3.6 中,您需要运行安装 Certificates.command"才能让 SSL 再次工作,但它似乎对我不起作用.

I am aware of the update in Python 3.6 where you need to run the 'Install Certificates.command' in order to get SSL working again, however it doesn't seem to work for me.

运行文件导致:

 -- pip install --upgrade certifi
 Requirement already up-to-date: certifi in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (2018.4.16)
  -- removing any existing file or link
  -- creating symlink to certifi certificate bundle
  -- setting permissions
  -- update complete

我也明确运行

pip3 install certifi
Requirement already satisfied: certifi in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (2018.4.16)

然而,当我尝试运行我的应用程序(使用 suds-py3)时,我得到以下内容:

Yet when I try to run my application (using suds-py3) I get the following:

Traceback (most recent call last):
  File "./get_docs.py", line 38, in <module>
    session = Client(url_SessionWebService)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/suds/client.py", line 111, in __init__
    self.wsdl = reader.open(url)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/suds/reader.py", line 151, in open
    d = self.fn(url, self.options)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/suds/wsdl.py", line 135, in __init__
    d = reader.open(url)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/suds/reader.py", line 78, in open
    d = self.download(url)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/suds/reader.py", line 94, in download
    fp = self.options.transport.open(Request(url))
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/suds/transport/http.py", line 174, in open
    return HttpTransport.open(self, request)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/suds/transport/http.py", line 63, in open
    return self.u2open(u2request)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/suds/transport/http.py", line 119, in u2open
    return url.open(u2request, timeout=tm)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 532, in open
    response = meth(req, response)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 642, in http_response
    'http', request, response, code, msg, hdrs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 564, in error
    result = self._call_chain(*args)
  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 756, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 526, in open
    response = self._open(req, data)
  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:833)>

我还尝试添加以下内容以绕过:

I've also tried adding the following to bypass:

import ssl
ssl._create_default_https_context = ssl._create_unverified_context

但结果调用似乎表明请求未通过身份验证

But the resulting call seems to indicate that the request was not authenticated

关于如何进一步调试的任何建议?

Any suggestions on how to further debug this?

推荐答案

刚刚解决了我这边的问题:要安装证书,请执行以下操作:

I have just solved the problem in my side: to install certifi do this:

python3 -m pip install --upgrade certifi --trusted-host pypi.org --trusted-host files.pythonhosted.org

您只需将该命令复制并粘贴到 Mac 终端或任何 IDE 终端(例如 Visual Studio 代码)中即可.

You just copy and paste that command in your Mac terminal or any IDE terminal such as Visual Studio code.

这篇关于CERTIFICATE_VERIFY_FAILED Python 3.6 mac osx 无法使用“Install Certificates.command"修复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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