可能解决方案:WARNING:Retrying (Retry(total=4...after connection broken by ‘SSLError...|Could not fetch URL

首先说一下背景:我是在服务器里面跑项目,然后服务器网络的话用的代理proxy

一、下面是我遇到的错误

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1131)'))': /simple/transformers/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1131)'))': /simple/transformers/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1131)'))': /simple/transformers/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1131)'))': /simple/transformers/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1131)'))': /simple/transformers/
Could not fetch URL https://pypi.org/simple/transformers/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/transformers/ (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1131)'))) - skipping
ERROR: Could not find a version that satisfies the requirement transformers (from versions: none)
ERROR: No matching distribution found for transformers
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:1131)'))) - skipping

错误来源于命令

pip install PackageName

同样地,错误也出现在conda上。

随后,我惊奇的发现,只有在我所创的环境里下载包才会有这样的问题,在base环境里完全可以下载包,一点问题都没有!!!

遇到的第二个问题:大概就是说,有时候pip不行 要用conda 而且可能还要在后面加-c pytorch
今天就是这样,最后成功的命令是

conda install pytorch=1.10.0 torchvision=0.11.1 cudatoolkit=10.2 -c pytorch

不加**-c pytorch**会报错,用 pip 好像也会报错,挺奇怪的,先记录记录吧。

二、解决思路

关于这个问题,网上主要有两种解决思路。

第一种,也就是使用镜像的方式(✘)

pip install PackageName -i xxx --trusted-host xxx

这类型的解决办法我就没成功解决过这类问题(服务器端)!

第二种,用export重新设置一次http代理 (✔)

下面是我之前用的

export http_proxy="http://xx.xx.xx.xx:xxxx"
export https_proxy="https://xx.xx.xx.xx:xxxx"

下面是我现在用的

export http_proxy="http://xx.xx.xx.xx:xxxx"
export https_proxy="http://xx.xx.xx.xx:xxxx"

注意看区别!
改了export后,问题成功被解决!

参考博文

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

eeeasyFan

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值