在Windows机器上运行pip install-由于Web代理而导致证书错误

时间:2018-11-12 12:43:46

标签: python ssl pip

我正在准备一个可以在公司网络中使用Python的环境。我相信由于我们在防火墙上使用SSL拦截,因此python不信任安装过程中提供的证书。我们使用Palo Alto防火墙,如果您检查任何SSL网站,都会看到该防火墙是所有SSL网站的签名证书。这是Windows工作站,Windows证书存储区中信任CA证书。当我运行命令

python -m pip install --upgrade pip

我收到此错误

PS U:\code> python -m pip install --upgrade pip
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1051)'))': /simple/pip/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1051)'))': /simple/pip/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1051)'))': /simple/pip/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1051)'))': /simple/pip/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1051)'))': /simple/pip/
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1051)'))) - skipping
Requirement already up-to-date: pip in c:\program files (x86)\python37-32\lib\site-packages (10.0.1)
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1051)'))) - skipping

我不确定最后是否要添加标签。我看到了类似的问题,但我认为它与存储库URL使用的特定证书无关。

link here

感谢您的帮助。谢谢!

1 个答案:

答案 0 :(得分:0)

您位于代理之后,因此pip无法到达python包索引。如果您的公司经营专用的pypi克隆,则必须更改位于pip.ini的{​​{1}}文件。如果尚不存在,请使用以下信息:

C:\Users\<you>\AppData\Roaming\pip\pip.ini

此url通常是某种人工产物。