python
network_error
ai_generated
true
错误:由于 SSLError 无法安装包:HTTPSConnectionPool(host='pypi.org', port=443): 超过最大重试次数,url: /simple/package/ (原因:SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败:证书链中的自签名证书 (_ssl.c:1006)')))
ERROR: Could not install packages due to an SSLError: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/package/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1006)')))
ID: python/pip-install-certificate-error
80%修复率
84%置信度
0证据数
2024-09-25首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.x | active | — | — | — |
根因分析
pip 无法验证 SSL 证书,因为证书链包含自签名证书,通常是由于企业代理或防病毒软件。
English
pip cannot verify the SSL certificate because the certificate chain includes a self-signed certificate, often due to a corporate proxy or antivirus software.
解决方案
-
90% 成功率
pip install --cert /path/to/corporate-ca.pem package
-
85% 成功率
pip install --upgrade certifi; export SSL_CERT_FILE=$(python -m certifi)
无效尝试
常见但无效的做法:
-
50% 失败
Disables SSL verification, exposing you to MITM attacks; not a proper fix.
-
60% 失败
Globally disables HTTPS verification for Python, affecting all libraries; insecure.