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
相关推荐
Two_brushes.3 小时前
【linux 网络】网络基础
linux·网络
Code Warrior3 小时前
【Linux】基础开发工具(3)
linux·服务器
鬼才血脉4 小时前
Linux(centos)安装 MySQL 8
linux·mysql·centos
guygg884 小时前
ubuntu手动编译VTK9.3 Generating qmltypes file 失败
linux·运维·ubuntu
JeffersonZU4 小时前
Linux/Unix 套接字Socket编程(socket基本概念,流程,流式/数据报socket,Unix domain socket示例)
linux·c语言·tcp/ip·udp·unix·gnu
Two_brushes.5 小时前
【linux网络】网络编程全流程详解:从套接字基础到 UDP/TCP 通信实战
linux·开发语言·网络·tcp/udp
夕泠爱吃糖5 小时前
Linux中的静态库和动态库
linux·运维·服务器
比奥利奥还傲.6 小时前
Linux运维安全新范式:基于TCPIP与SSH密钥的无密码认证实战
linux·运维·安全
诗意亭序7 小时前
ubuntu16.04 虚拟机与电脑共用wifi
ubuntu
scilwb7 小时前
Isaac Sim 4.5中iRobot Create 3机器人LightBeam传感器系统完整实现教程
ubuntu