python pip install报错 unable to g

2023-11-23  本文已影响0人  michaelxwang

本质是ssl证书认证失败。我们需要访问的是http的链接,但是访问https:的了,所以访问失败。

报错信息

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(SSLEOFError(8, ‘EOF occurred in violation of protocol (_ssl.c:1125)’))) - skipping

解决方案

直接设置global的配置,即到C:/ProgramData下创建pip文件夹,新建pip.ini
查看pip global路径

pip -v config list
image.png

新建文件夹以及pip.ini文件

image.png

放入信任地址

[global]
trusted-host = pypi.python.org
               pypi.org
               files.pythonhosted.org
               pypi.douban.com
               mirrors.tuna.tsinghua.edu.cn
               mirrors.aliyun.com
image.png

参考:官网 https://pip.pypa.io/en/latest/topics/configuration/

上一篇下一篇

猜你喜欢

热点阅读