当前位置: 首页 > news >正文

ubuntu 20.04 Python pip 配置 pip.conf

1. 状况描述

$ pip install timm
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response'))': /simple/timm/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response'))': /simple/timm/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response'))': /simple/timm/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response'))': /simple/timm/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response'))': /simple/timm/
ERROR: Could not find a version that satisfies the requirement timm (from versions: none)
ERROR: No matching distribution found for timm

2. 解决方法

  1. 用 ping 看看网络情况
$ ping www.baidu.com
PING www.baidu.com(240e:ff:e020:9ae:0:ff:b014:8e8b (240e:ff:e020:9ae:0:ff:b014:8e8b)) 56 data bytes
64 bytes from 240e:ff:e020:9ae:0:ff:b014:8e8b (240e:ff:e020:9ae:0:ff:b014:8e8b): icmp_seq=1 ttl=54 time=11.2 ms
64 bytes from 240e:ff:e020:9ae:0:ff:b014:8e8b (240e:ff:e020:9ae:0:ff:b014:8e8b): icmp_seq=2 ttl=54 time=11.1 ms
64 bytes from 240e:ff:e020:9ae:0:ff:b014:8e8b (240e:ff:e020:9ae:0:ff:b014:8e8b): icmp_seq=3 ttl=54 time=11.4 ms
64 bytes from 240e:ff:e020:9ae:0:ff:b014:8e8b (240e:ff:e020:9ae:0:ff:b014:8e8b): icmp_seq=4 ttl=54 time=12.1 ms
64 bytes from 240e:ff:e020:9ae:0:ff:b014:8e8b (240e:ff:e020:9ae:0:ff:b014:8e8b): icmp_seq=5 ttl=54 time=9.26 ms
64 bytes from 240e:ff:e020:9ae:0:ff:b014:8e8b (240e:ff:e020:9ae:0:ff:b014:8e8b): icmp_seq=6 ttl=54 time=12.9 ms
^C
--- www.baidu.com ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5008ms
rtt min/avg/max/mdev = 9.264/11.309/12.898/1.112 ms
  1. 配置 pip.conf
$ mkdir ~/.pip
$ touch ~/.pip/pip.conf
$ gedit ~/.pip/pip.conf

pip.conf 的内容:

[global]
proxy = socks5://127.0.0.1:1080
index-url = https://mirror.baidu.com/pypi/simple/
extra-index-url = http://mirrors.aliyun.com/pypi/simple/
trusted-host = pypi.baidu.com mirrors.aliyun.com                    timeout = 120
http://www.lryc.cn/news/317508.html

相关文章:

  • GPT-4.5 Turbo意外曝光,最快明天发布?OpenAI终于要放大招了!
  • Ubuntu 中 desktop-amd64 和 live-server-amd64 的区别
  • 第10集《天台教观纲宗》
  • 每日学习笔记:C++ STL 的forward_list
  • 【Java,Redis】Redis 数据库存取字符串数据以及类数据
  • OpenCV 图像重映射函数remap()实例详解
  • Python基础课堂最后一课23——正则对象
  • 【算法训练营】凸包,图(Python实现)
  • webpack5零基础入门-6webpack处理图片资源
  • 计算机基础知识QA
  • 微信小程序一次性订阅requestSubscribeMessage授权和操作详解
  • ARM 汇编指令:(三)运算处理指令
  • 【C++庖丁解牛】STL简介 | string容器初次见面
  • 记OnlyOffice的两个大坑
  • 分享几个Google Chrome谷歌浏览器历史版本下载网站
  • 备考2025年AMC8竞赛:吃透2000-2024年600道真题(免费赠送真题)
  • 考研复试C语言篇
  • Docker架构深度解析:守护进程、客户端与存储驱动的协同作战(下)
  • 【强化学习笔记一】初识强化学习(定义、应用、分类、性能指标、小车上山案例及代码)
  • 安卓面试准备汇总
  • C#+datax实现定时增量同步
  • VUE实现Provide的计算属性
  • Spring Schedule:Spring boot整合Spring Schedule实战讲解定时发送邮件的功能
  • Midjourney绘图欣赏系列(十)
  • 【C语言】人生重开模拟器
  • 船舶AIS监控网络-船位信息查询:实时查询船舶动态,服务于船舶安全航行管理、港口调度计划、物流、船代、货代。【AIS动态信息编写船舶轨迹】
  • Axios 中的文件上传(Upload File)方法
  • 机试:数塔路径
  • ROS2中launch编写及参数含义(xml、python)
  • 鸿蒙Socket通信示例(TCP通信)