python network_error ai_generated true

错误:由于OSError无法安装包:HTTPS连接池超过最大重试次数(由SSLError引起:证书验证失败:无法获取本地颁发者证书)

ERROR: Could not install packages due to an OSError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/... (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate')))

ID: python/pip-ssl-certificate-verify-failed

其他格式: JSON · Markdown 中文 · English
80%修复率
85%置信度
0证据数
2025-01-15首次发现

版本兼容性

版本状态引入弃用备注
3.10 active

根因分析

由于系统缺少或CA证书过期,SSL证书验证失败。

English

SSL certificate verification fails due to missing or outdated CA certificates on the system.

generic

解决方案

  1. 90% 成功率 Update CA certificates
    pip install --upgrade certifi
    # Or system level: sudo update-ca-certificates
  2. 85% 成功率 Use a custom CA bundle if behind corporate proxy
    pip install --cert /path/to/custom-ca-bundle.crt package

无效尝试

常见但无效的做法:

  1. Disabling SSL verification with --trusted-host 30% 失败

    Security risk; may work but exposes to man-in-the-middle attacks.

  2. Using --cert with wrong path 70% 失败

    Path to certificate may be incorrect or file missing.