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

安装Python模块遇TLS CA证书路径错误,求解决方法

解决pip安装Python模块的TLS CA证书路径错误

ERROR: Could not install packages due to an OSError: Could not find a suitable TLS CA certificate bundle, invalid path: /path/to/cacert.pem
WARNING: There was an error checking the latest version of pip.

  • 确认证书路径有效性
    检查/path/to/cacert.pem是否为真实存在的文件路径,若路径错误,替换为实际证书文件的正确路径。

  • 安装时指定证书路径
    安装模块时通过--cert参数指定有效证书:

    pip install 目标模块名 --cert /实际路径/cacert.pem
    

    若需永久生效,设置环境变量:

    # Linux/macOS终端
    export PIP_CERT=/实际路径/cacert.pem
    # Windows命令提示符
    set PIP_CERT=C:\实际路径\cacert.pem
    # Windows PowerShell
    $env:PIP_CERT = "C:\实际路径\cacert.pem"
    
  • 修复或重新安装pip
    尝试更新pip以修复配置异常:

    python -m ensurepip --upgrade
    

    若无效,用脚本重新安装pip(需指定有效证书):

    curl https://bootstrap.pypa.io/get-pip.py | python - --cert /实际路径/cacert.pem
    
  • 切换为系统默认CA证书
    若无需自定义证书,取消PIP_CERT环境变量,让pip使用系统默认证书:

    # Linux/macOS
    unset PIP_CERT
    # Windows命令提示符
    set PIP_CERT=
    # Windows PowerShell
    Remove-Item Env:PIP_CERT
    

内容的提问来源于stack exchange,提问作者bb aa

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.20 04:10:03