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
相关推荐
LN花开富贵2 小时前
Ubuntu aarch64 架构安装 NoMachine 远程控制 避坑与实战
linux·运维·笔记·学习·ubuntu·嵌入式
取经蜗牛2 小时前
Windows 11 WSL + Ubuntu 24.04 安装指南
linux·windows·ubuntu
杨云龙UP2 小时前
Oracle RAC/ODA环境下如何准确查询PDB表空间已分配大小?一次说清Oracle表空间逻辑大小和ASM三副本实际占用_2026-05-19
linux·运维·数据库·sql·oracle·ffmpeg
2023自学中2 小时前
imx6ull开发板,Linux-c编程,识别 键盘、鼠标、触摸屏坐标
linux·嵌入式·开发板·应用编程
步十人3 小时前
【Linux】环境配置
linux·运维·服务器
念恒123063 小时前
MySQl安装
linux·运维·服务器
kaoa0003 小时前
Linux入门攻坚——77、虚拟化技术基础原理-2
linux·服务器·网络
vortex53 小时前
现代 Linux 包管理全景:从 apt 到 Nix,四大派系与四大范式
linux·运维·服务器
曦夜日长3 小时前
Linux系统篇,开发工具(四):make及makefile的使用、makefile的使用细节
linux·运维·服务器
历程里程碑4 小时前
54 深入解析poll多路复用技术
java·linux·服务器·开发语言·前端·数据结构·c++