无法在 Windows 10 上的 pycharm 中安装软件包,出现 SSL 验证失败错误

无法在 Windows 10 上的 pycharm 中安装软件包,出现 SSL 验证失败错误

我正在尝试按照以下步骤在 pycharm 中安装 HL7 apy 包。

File-->Settings-->Project Interpreter-->click + sign-->search package-->Install package. 之后出现以下错误。

Could not fetch URL https://pypi.org/simple/hl7apy/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/hl7apy/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)'))) - skipping
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: unable to get local issuer certificate (_ssl.c:1056)'))) - skipping

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: unable to get local issuer certificate (_ssl.c:1056)'))': /simple/hl7apy/
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: unable to get local issuer certificate (_ssl.c:1056)'))': /simple/hl7apy/
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: unable to get local issuer certificate (_ssl.c:1056)'))': /simple/hl7apy/
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: unable to get local issuer certificate (_ssl.c:1056)'))': /simple/hl7apy/
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: unable to get local issuer certificate (_ssl.c:1056)'))': /simple/hl7apy/
Could not find a version that satisfies the requirement hl7apy (from versions: )
No matching distribution found for hl7apy

谁能帮忙。有点紧急。我可以通过添加受信任的主机通过命令终端安装包。但是当我在 pycharm IDE 中导入该包时,它不起作用。

答案1

在 创建一个 pip 配置文件%APPDATA%\pip\pip.ini

就我而言,我必须创建 pip 文件夹和 pip.ini 文件,然后在其中填充以下内容:

[global]
trusted-host = pypi.python.org
               pypi.org
               files.pythonhosted.org

重新启动 PyCharm 并且成功了。

參閱https://pip.pypa.io/en/stable/user_guide/?highlight=appdata#config-filehttps://stackoverflow.com/a/29751768/1050178

相关内容