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
相关推荐
特立独行的猫a23 分钟前
在 Windows 10 上安装和使用 WSL 2 安装 Ubuntu24详细指南
windows·ubuntu·wsl2
倔强的石头10623 分钟前
KaiwuDB社区版 3.1.0 在 Ubuntu 22.04 部署实战:TLS 配置、踩坑复盘与轻量压测
数据库·ubuntu·kwdb
liwenzhuola23 分钟前
解决 Ubuntu 上 Qt Creator 项目编译失败的问题
数据库·qt·ubuntu
济61725 分钟前
ARM Linux 驱动开发篇---基于 pinctrl+GPIO 子系统的蜂鸣器驱动开发(设备树版)--- Ubuntu20.04
linux·嵌入式·嵌入式linux驱动开发
AiGuoHou128 分钟前
Debian/Ubuntu 各个版本一键更换国内镜像源
linux·ubuntu·国内源·debian·镜像源·换源
衡动科技28 分钟前
Ubuntu 22.04/24.04 安装 ROS2 完整教程(Humble / Jazzy)
ubuntu·树莓派·ros2
蓝羽天空29 分钟前
Ubuntu 24.04 安装 Docker
linux·ubuntu·docker
T0uken29 分钟前
WSL:离线配置 Ubuntu 开发环境
linux·运维·ubuntu
�羡阳丶30 分钟前
ubuntu22.04+5060显卡双系统安装,各种黑屏踩坑记录
linux·经验分享·ubuntu
b_xinjun112030 分钟前
树莓派 Ubuntu 24.04.3 LTS 安装 OpenClaw 操作说明
linux·ubuntu·arcgis