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
相关推荐
tianyuanwo8 小时前
深入解析 RISC-V 虚拟化中的 UEFI 固件配置:从 XML 到 NVRAM 的生命周期管理
xml·linux·risc-v
道川贤林9 小时前
OrangePi 系统启动优先级修改
linux·linux驱动·orangepi·u-boot
xsc-xyc9 小时前
用 Tailscale + Syncthing 实现手机、电脑与 NAS 的跨网络文件同步
linux·网络·网络安全·智能手机·电脑
IsJunJianXin9 小时前
pdd小程序 cdp 保存响应体
linux·服务器·小程序·pdd小程序·拼多多响应体解密·小程序cdp·拼多多rpc取响应体
爱就是恒久忍耐10 小时前
现代CMake的build方式
linux·运维·服务器
古城小栈11 小时前
Python 的主流Ai框架为什么优先适配 Linux 系统?
linux·人工智能·python
字节高级特工12 小时前
【Linux】C语言进程地址空间分布
linux·c++·后端·算法
黑白园12 小时前
【环境搭建】Ubuntu安装(一)
linux·ubuntu
Moshow郑锴12 小时前
Ubuntu用SDKMAN轻松管理多个Java 版本
java·ubuntu·sdkman
aFakeProgramer12 小时前
S-CORE Docker 环境
linux