"There was a problem confirming the ssl certificate" 在本地工件存储库上执行 pip 安装时

"There was a problem confirming the ssl certificate" when doing pip install on a local artifactory repository

我可以使用一些指导来解决在 运行 pip install。这个“自签名证书”是否应该替换为该服务器提供的特定证书?

Could not fetch URL [our.artifactory.server.name]/simple/hercl/: 
There was a problem confirming the ssl certificate: HTTPSConnectionPool
   (host='[our.artifactory.server.name]', port=443): 
Max retries exceeded with url: 
    /api/pypi/our.artifactory.server.name-local/simple/hercl/ (Caused by SSLError(SSLCertVerificationError(1, 
'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: 
self signed certificate in certificate chain (_ssl.c:1131)'))) - skipping

记入pip.pypa.io:

Starting with v1.3, pip provides SSL certificate verification over HTTP, to prevent man-in-the-middle attacks against PyPI downloads. This does not use the system certificate store but instead uses a bundled CA certificate store. The default bundled CA certificate store certificate store may be overridden by using --cert option or by using PIP_CERT, REQUESTS_CA_BUNDLE, or CURL_CA_BUNDLE environment variables.

关于 SSL 问题,这取决于您是否坚持执行 SSL,如果不是,您可以使用现有标志通过附加 --trusted-host 来忽略它,在下面的示例中:--trusted-host artifactory.

这里也提出了一些解决这个问题的建议:pip install fails with "connection error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)"

请注意,在使用 artifactory 作为 Pypi 包的 caching/proxy 服务器之前,您应该根据 SetMeUp 说明配置 pip.conf 和 .pypirc 文件:https://www.jfrog.com/confluence/display/JFROG/PyPI+Repositories#PyPIRepositories-ResolvingfromArtifactoryUsingpip

例如:

pip.conf:

[global]
index-url = http://artifactory:8081/artifactory/api/pypi/pypi-virtual/simple

.pypirc:

[distutils]
index-servers =
    virtual
    local
    remote
    devpi

[virtual]
repository: http://artifactory:8081/artifactory/api/pypi/pypi-virtual
username: admin
password: ***

[local]
repository: http://artifactory:8081/artifactory/api/pypi/pypi-local
username: admin
password: ***

[remote]
repository: http://artifactory:8081/artifactory/api/pypi/pypi-org-remote
username: admin
password: ***

[devpi]
repository: http://localhost:3141/admin/dev
username: admin
password: ***