我在进行诗歌安装时收到 SSL CERTIFICATE_VERIFY_FAILED

ale*_*exa 14 python connection ssl amazon-web-services

我正在尝试创建一个虚拟环境,并且我过去能够通过诗歌安装来做到这一点。但现在当尝试执行 a 时poetry install,我收到以下消息:

\n
Max retries exceeded with url: /pypi/six/1.16.0/json (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')))\n\n  at ~/.poetry/lib/poetry/_vendor/py3.9/requests/adapters.py:514 in send\n      510\xe2\x94\x82                 raise ProxyError(e, request=request)\n      511\xe2\x94\x82 \n      512\xe2\x94\x82             if isinstance(e.reason, _SSLError):\n      513\xe2\x94\x82                 # This branch is for urllib3 v1.22 and later.\n    \xe2\x86\x92 514\xe2\x94\x82                 raise SSLError(e, request=request)\n      515\xe2\x94\x82 \n      516\xe2\x94\x82             raise ConnectionError(e, request=request)\n      517\xe2\x94\x82 \n      518\xe2\x94\x82         except ClosedPoolError as e:\n\n
Run Code Online (Sandbox Code Playgroud)\n

小智 26

对我有用的(MacOS)转到应用程序> Python文件夹>双击“安装Certificates.command”文件


Chr*_*fer 8

Python 的 requests 库似乎找不到您的证书。

您是否使用自签名证书配置了自定义存储库? 如果是这样,我还没有找到解决这个问题的好办法。在这种情况下,请检查您是否设置了 CURL_CA_BUNDLE 环境变量:

$回显$CURL_CA_BUNDLE

如果这指向某个自定义位置/自签名证书,则请求无法使用其标准证书包。您可以取消设置它(可能会对使用它的服务产生副作用):

导出 CURL_CA_BUNDLE=""

如果您尚未配置任何自定义存储库/证书:

您也许可以通过安装certifi来解决此问题