pip install xxx:There was a problem confirming the ssl certificate: HTTPSConnectionPool

一、问题

在使用Pip install xxx的时候,经常会报这样的一个错误。

(myenv) PS E:\WorkSpace\1v6_code_fs> pip3 install torch                                                                                            
ction has been closed (EOF) (_ssl.c:1131)'))': /simple/torch/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLZeroReturnError(6, 'TLS/SSL conne
ction has been closed (EOF) (_ssl.c:1131)'))': /simple/torch/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLZeroReturnError(6, 'TLS/SSL conne
ction has been closed (EOF) (_ssl.c:1131)'))': /simple/torch/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLZeroReturnError(6, 'TLS/SSL conne
ction has been closed (EOF) (_ssl.c:1131)'))': /simple/torch/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLZeroReturnError(6, 'TLS/SSL conne
ction has been closed (EOF) (_ssl.c:1131)'))': /simple/torch/
Could not fetch URL https://pypi.org/simple/torch/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retri
es exceeded with url: /simple/torch/ (Caused by SSLError(SSLZeroReturnError(6, 'TLS/SSL connection has been closed (EOF) (_ssl.c:1131)'))) - skipping
ERROR: Could not find a version that satisfies the requirement torch (from versions: none)
ERROR: No matching distribution found for torch

二、原因

出现这个问题的原因是什么:

此时需要获得 ssl证书的认证,需要在原来的安装命令后增加:
-i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com (也可换其他源)

三、解决办法

(myenv) PS E:\WorkSpace\1v6_code_fs> pip install scipy -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
Looking in indexes: http://mirrors.aliyun.com/pypi/simple
Requirement already satisfied: scipy in c:\programdata\anaconda3\envs\myenv\lib\site-packages (1.10.1)
Requirement already satisfied: numpy<1.27.0,>=1.19.5 in c:\programdata\anaconda3\envs\myenv\lib\site-packages (from scipy) (1.24.4)
(myenv) PS E:\WorkSpace\1v6_code_fs> pip install torch -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
Looking in indexes: http://mirrors.aliyun.com/pypi/simple
  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值