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
相关推荐
tianyuanwo13 小时前
深入理解 Linux 启动救援模式与控制台选择:从 x86 的 tty0 到 ARM 的 ttyS0
linux·grub·救援系统
瞬间&永恒~14 小时前
【MySQL】练习5-1:配置慢查询日志
linux·运维·云原生
邪修king14 小时前
Re:Linux系统篇(四):权限Chapter--用户身份、权限位与目录权限三大核心问题
linux·运维·服务器
buhuizhiyuci15 小时前
【Linux 篇】数字世界的通信管道 —— 匿名管道与进程池深度实战解析
linux·运维·服务器
道尔柯南15 小时前
【Linux】基础开发工具Vim
linux·运维·vim
江南风月15 小时前
WGCLOUD是如何监控服务器上的异常进程的
linux·运维·服务器
无锡耐特森15 小时前
ModbusTCP转Profinet:打通潜油电泵工业互联新路径
linux·运维·服务器
黑白园16 小时前
个人台式机VMware 15及Ubuntu 16.04.5卸载以及VMware 16.2.3及Ubuntu 24.04.4安装
linux·ubuntu
腾科IT教育1 天前
Oracle认证怎么选?2026年OCP/OCM报考指南
linux·运维·华为认证·hcie·开闭原则·datacom
longerxin20201 天前
nano编辑器插入、编辑完整操作教程(Linux日志/配置专用)
linux·运维·编辑器