pip在ubuntu下换源

一、参考资料

pip在windows下换源

pypi镜像-pypi下载地址-pypi安装教程-阿里巴巴开源镜像站

二、关键步骤

添加源

创建pip配置文件:

python 复制代码
mkdir ~/.pip

sudo gedit ~/.pip/pip.conf

添加以下内容:

bash 复制代码
[global]
timeout = 6000
index-url = https://mirrors.aliyun.com/pypi/simple/
trusted-host = mirrors.aliyun.com

或者通过指令修改:

bash 复制代码
pip config set global.index-url  https://pypi.org/simple  

删除源:

bash 复制代码
pip config unset global.index-url

查看现在用的哪个源:

bash 复制代码
pip config list

输出结果:

bash 复制代码
(consistent_depth) C:\Users\YOYO>pip config list
global.index-url='https://mirrors.aliyun.com/pypi/simple/'
global.timeout='6000'
global.trusted-host='mirrors.aliyun.com'

其他pip源:

bash 复制代码
清华大学	   https://pypi.tuna.tsinghua.edu.cn/simple/
阿里云	        http://mirrors.aliyun.com/pypi/simple/
中国科技大学 	  https://pypi.mirrors.ustc.edu.cn/simple/
腾讯云         http://mirrors.cloud.tencent.com/pypi/simple

Pypi官方       https://pypi.org/simple/

三、FAQ

Q:pip list出现警告

bash 复制代码
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.

解决方法 :修改 pip.conf 配置,添加如下内容。

bash 复制代码
sudo gedit ~/.pip/pip.conf

添加以下内容:

bash 复制代码
[list]
format=columns
或者
format=legacy
相关推荐
prince_zxill5 小时前
PEP 751 pylock.toml 实测:pip 26.3 装 6 个包版本全钉死,但 [web] 选不中任何东西
python·pip·依赖管理·pep 751
kyle~7 小时前
嵌入式 SoC 系统
linux·c++·嵌入式·计算系统
人生!?9 小时前
Linux 从入门到进阶 | 基础语法
linux·笔记·教程
心之王者71610 小时前
Linux 进程信号:从产生、阻塞到捕捉与子进程回收
linux·服务器·网络
AndreaYYmm10 小时前
日志里 grep 到 Fail 就判失败?这六个假阳性我全踩过
linux·shell
爱吃香菜的初学者11 小时前
二十五.Linux——epoll
linux·运维·服务器
少司府11 小时前
嵌入式外设篇(一)GPIO·一:认识GPIO
linux·单片机·嵌入式硬件·mcu·系统·rtos·嵌入式软件
无奈笑天下13 小时前
银河麒麟上DHCP无法获取IP地址问题处理
linux·运维·服务器·网络协议
蜗牛一步步往上爬13 小时前
第六章 使用Linux环境变量
linux·运维
Vex2une14 小时前
电脑装双系统怎么弄?Win+Win 与 Win+Linux 安装及启动菜单管理全攻略
linux·windows·电脑·uefi·双系统安装·bcdedit启动项