You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用pip安装Levenshtein时遇SSL证书验证失败错误求助

解决pip安装Levenshtein时的SSL证书验证失败问题

错误信息

ERROR: Could not install packages due to an OSError:
HTTPSConnectionPool(host='files.pythonhosted.org', port=443):
Max retries exceeded with url:
/packages/7b/be/21ea38c3d63a1345a338c495ebe7c29c1e5fa915d4a7b71a7b25117a1d10/Levenshtein-0.20.5-cp310-cp310-win_amd64.whl
(Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed:
self signed certificate in certificate chain (_ssl.c:997)')))

解决方法

  • 临时跳过SSL验证(仅临时使用)
    执行命令:

    pip install levenshtein --trusted-host pypi.org --trusted-host files.pythonhosted.org
    

    该命令指定信任PyPI的核心域名,临时绕过证书验证。

  • 永久配置pip信任域名
    创建或修改pip配置文件:

    • Windows:路径为%APPDATA%\pip\pip.ini
    • Linux/macOS:路径为~/.config/pip/pip.conf
      在文件中添加以下内容:
    [global]
    trusted-host = pypi.org
                   files.pythonhosted.org
    

    保存后重新执行pip install levenshtein即可。

  • 更新系统根证书

    • Windows:打开「Internet选项」→「内容」→「证书」,导入缺失的根证书;或通过Windows更新安装最新证书包。
    • Linux(Ubuntu/Debian):执行sudo apt update && sudo apt install ca-certificates
    • Linux(CentOS/RHEL):执行sudo yum update ca-certificates
    • macOS:打开「钥匙串访问」,将缺失证书添加到系统信任区;或执行sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain /path/to/your/certificate.crt(替换证书实际路径)。
  • 使用国内PyPI镜像源
    国内镜像源通常无证书问题,且下载速度更快,执行命令:

    pip install levenshtein -i https://mirrors.aliyun.com/pypi/simple/
    

内容的提问来源于stack exchange,提问作者Pauli du Plooy

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.16 19:45:42