python WARNING: Retrying (Retry(total=4, connect...) ERROR: Cannot determine archive format of /tmp/

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000022DEDF31B40>, 'Connection to files.pyth
onhosted.org timed out. (connect timeout=15)')': /packages/67/4e/5959c5822f0694e4c2beb93f9ee34b8ec49052fc79d88f8842d9ded7
2f02/matplotlib-3.5.2-cp310-cp310-win_amd64.whl
解决方法:出现该错误信息是因为pip源连接证书验证失败,将pip源调整为国内的源就可以了,比如要下载fitlog

pip install fitlog http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com

下面是收集的一些国内的pip源:

阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/ 
豆瓣(douban) http://pypi.douban.com/simple/ 
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/

如果想要永久修改pip源,可按照如下操作:

Windows:

1、找到系统盘下C:\Users\用户名\AppData\Roaming

2、查看在Roaming文件夹下有没有一个pip文件夹,如果没有创建一个;

3、进入pip文件夹,创建一个pip.ini文件;

4、使用记事本的方式打开pip.ini文件,写入:
 

[global]
index-url = http://mirrors.aliyun.com/pypi/simple  # 指定下载源
trusted-host = mirrors.aliyun.com             # 指定域名

Linux:

# 找到~/.pip/pip.conf,如果不存在就创建,加入内容如下 
[global]
timeout = 10 # 设置超时,单位s
index-url =  http://mirrors.aliyun.com/pypi/simple/   # 指定优先下载源
extra-index-url= http://pypi.douban.com/simple/   # 第二下载源
[install]
trusted-host=
    mirrors.aliyun.com
    pypi.douban.com

 

1. 问题处理

当我们更换镜像源进行pip 安装时,可能会出现报错:ERROR: Cannot determine archive format of :XXXXXXXXXX
比如我刚开始安装fitlog:

pip install -i https://pypi.douban.com/simple fitlog

出现了上面的错误,下面我们只需要改成如下即可:

pip install -i https://pypi.douban.com/simple --trusted-host pypi.douban.com fitlog

 当我们用其他源进行安装时,出现上面问题时。同样可以使用这种解决方法:

# 以清华源为例
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn 模块名

 


 

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值