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
相关推荐
是阿建吖!12 分钟前
【Linux | 网络】网络编程套接字
linux·网络
退役小学生呀24 分钟前
十、K8s集群资源合理化分配
linux·云原生·容器·kubernetes·k8s
Winner13001 小时前
Debian、Buildroot 和 Ubuntu 都是基于 Linux 的系统区别
linux·ubuntu·debian
1nullptr2 小时前
UNIX程序设计基本概念和术语
linux
是阿建吖!2 小时前
【Linux | 网络】网络基础
linux·网络
mmoyula2 小时前
【RK3568 驱动开发:实现一个最基础的网络设备】
android·linux·驱动开发
阿杆2 小时前
😡同事查日志太慢,我现场教他一套 grep 组合拳!
linux·后端
墨小傲3 小时前
基于Linux下的vscode c/c++开发环境搭建详细教程
linux·c语言·vscode
cui_win3 小时前
【网络】Linux 内核优化实战 - net.ipv4.tcp_timestamps
linux·网络·tcp/ip
czhc11400756633 小时前
Linux 77 FTP
linux·运维·服务器