首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在进行诗歌安装时,我会收到SSL CERTIFICATE_VERIFY_FAILED。

在进行诗歌安装时,我会收到SSL CERTIFICATE_VERIFY_FAILED。
EN

Stack Overflow用户
提问于 2021-11-02 17:51:17
回答 3查看 5K关注 0票数 4

我试图创造一个虚拟的环境,我能够在过去做的诗歌安装。但是现在,当我尝试做一个poetry install时,我会收到这样的消息:

代码语言:javascript
运行
复制
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)')))

  at ~/.poetry/lib/poetry/_vendor/py3.9/requests/adapters.py:514 in send
      510│                 raise ProxyError(e, request=request)
      511│ 
      512│             if isinstance(e.reason, _SSLError):
      513│                 # This branch is for urllib3 v1.22 and later.
    → 514│                 raise SSLError(e, request=request)
      515│ 
      516│             raise ConnectionError(e, request=request)
      517│ 
      518│         except ClosedPoolError as e:
EN

回答 3

Stack Overflow用户

发布于 2022-03-08 06:25:16

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

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

$ echo $CURL_CA_BUNDLE

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

出口CURL_CA_BUNDLE="“

如果没有配置任何自定义存储库/证书,则为

您也许可以通过安装证书来解决这个问题。

票数 6
EN

Stack Overflow用户

发布于 2022-09-21 19:28:17

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

票数 5
EN

Stack Overflow用户

发布于 2022-08-26 23:24:06

Python3.7安装在MacOSX系统上时,需要运行一个脚本,通过bash在您的系统上安装系统上的证书依赖项。

代码语言:javascript
运行
复制
#!/bin/sh

/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 << "EOF"

# install_certifi.py
#
# sample script to install or update a set of default Root Certificates
# for the ssl module.  Uses the certificates provided by the certifi package:
#       https://pypi.org/project/certifi/

import os
import os.path
import ssl
import stat
import subprocess
import sys

STAT_0o775 = ( stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR
             | stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP
             | stat.S_IROTH |                stat.S_IXOTH )

def main():
    openssl_dir, openssl_cafile = os.path.split(
        ssl.get_default_verify_paths().openssl_cafile)

    print(" -- pip install --upgrade certifi")
    subprocess.check_call([sys.executable,
        "-E", "-s", "-m", "pip", "install", "--upgrade", "certifi"])

    import certifi

    # change working directory to the default SSL directory
    os.chdir(openssl_dir)
    relpath_to_certifi_cafile = os.path.relpath(certifi.where())
    print(" -- removing any existing file or link")
    try:
        os.remove(openssl_cafile)
    except FileNotFoundError:
        pass
    print(" -- creating symlink to certifi certificate bundle")
    os.symlink(relpath_to_certifi_cafile, openssl_cafile)
    print(" -- setting permissions")
    os.chmod(openssl_cafile, STAT_0o775)
    print(" -- update complete")

if __name__ == '__main__':
    main()
EOF

这是bash脚本的内容,该脚本安装证书包ssl证书。它还应该位于应用程序中安装的Python文件夹中。

代码语言:javascript
运行
复制
cd /Applications/Python\ 3.7/
./Install\ Certificates.command
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69814872

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档