问题描述
开了网络代理之后,python 的 pip 就无法安装包了,报如下错误:
$ pip install netsm Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple 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:1123)'))': /simple/netsm/ 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:1123)'))': /simple/netsm/ 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:1123)'))': /simple/netsm/ 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:1123)'))': /simple/netsm/ 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:1123)'))': /simple/netsm/ Could not fetch URL https://pypi.tuna.tsinghua.edu.cn/simple/netsm/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.tuna.tsinghua.edu.cn', port=443): Max retries exceeded with url: /simple/netsm/ (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1123)'))) - skipping ERROR: Could not find a version that satisfies the requirement netsm (from versions: none) ERROR: No matching distribution found for netsm
原因分析
想必很多同学都和我一样,配置了 pip 源为国内的清华源或阿里源,这样下载包的速度会快,以清华源为例,配置方法如下:
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
然而,配置清华源之后,pip 安装的时候就是从清华的镜像仓库来抓取安装包,但是清华的网络会对一些境外的网络代理做屏蔽或过滤,因此导致开了代理之后,pip 就无法安装包了。
解决方案
临时方案
临时方案就很简单了,直接把代理关了就行了。但你要安装很多包的话,就很麻烦,得反复的开关代理,推荐下面的永久解决方案。
永久方案
既然 pip 镜像源(无论还是清华,亦或是阿里)对代理服务器进行了屏蔽,那么我们访问镜像源的时候就不要走代理网络了。再系统的代理设置里面,直接将镜像源的域名做隔断处理:
即在代理服务器设置里面,请勿对以下条目开头的地址使用代理服务器,以清华源为例,就是添加 pypi.tuna.tsinghua.edu.cn,注意前面的分号 ;。
猜你喜欢
- 6天前(鄂尔多斯航空公司客服电话)架起“北方之路” ,中国联合航空带您飞向鄂尔多斯重回1倍速
- 6天前(上海文旅产业发展高峰论坛)《上海打造文旅元宇宙新赛道行动方案》发布
- 6天前(天气预报 华为)2025HDC华为天气上新系统级天气智能体,引领更智能的气象服务
- 6天前(云南南博会展馆)旅居云南馆亮相第9届南博会
- 6天前(曼谷丽思卡尔顿公寓价格)曼谷丽思卡尔顿酒店盛大启幕,开创泰国奢华雅致新纪元
- 6天前(万豪旅享家活动2021)精彩上新,漫享夏日----跟随万豪旅享家新开酒店解锁夏日旅行灵感
- 6天前(大连aaaaa景区)辽宁大连A级旅游景区应急救护水平整体跃升
- 6天前(大黄山景区高质量发展联盟成立多少年)大黄山景区高质量发展联盟成立
- 6天前(新西兰登陆《我的世界》!全球首个目的地游戏模组震撼上线)新西兰登陆《我的世界》!全球首个目的地游戏模组震撼上线
- 6天前(曹妃甸美仑华府哪个楼层好)曹妃甸新城教育经济新引擎启动—美仑国际酒店盛大开业
网友评论
- 搜索
- 最新文章
- (2020广州车展哈弗)你的猛龙 独一无二 哈弗猛龙广州车展闪耀登场
- (哈弗新能源suv2019款)智能科技颠覆出行体验 哈弗重塑新能源越野SUV价值认知
- (2021款全新哈弗h5自动四驱报价)新哈弗H5再赴保障之旅,无惧冰雪护航哈弗全民电四驱挑战赛
- (海南航空现况怎样)用一场直播找到市场扩张新渠道,海南航空做对了什么?
- (visa jcb 日本)优惠面面俱到 JCB信用卡邀您畅玩日本冰雪季
- (第三届“堡里有年味·回村过大年”民俗花灯会活动)第三届“堡里有年味·回村过大年”民俗花灯会活动
- (展示非遗魅力 长安启源助力铜梁龙舞出征)展示非遗魅力 长安启源助力铜梁龙舞出征
- (阿斯塔纳航空公司)阿斯塔纳航空机队飞机数量增至50架
- (北京香港航班动态查询)香港快运航空北京大兴新航线今日首航
- (我在港航“呵护”飞机 每一次安全着陆就是最好的荣誉)我在港航“呵护”飞机 每一次安全着陆就是最好的荣誉
- 热门文章