linux下给pip换源

AffettoIris 2023-11-23 2,774 11/23

 

国内镜像列表

Centos配置过程

临时换源

后面的–trusted-host 是指设置为受信源,否则在安全性较高的连接下是连接不上的。

以安装pandas为例:

pip install pandas -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn

永久换源

cd ~  # 切换到用户的主目录
mkdir .pip
cd .pip
vim pip.conf # 会自动创建
# 以清华的源为例,把下边的三行代码复制进去
[global]
index-url=https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn

验证换源成功

只要pip install 某个库,观察下载数据的来源即可。

linux下给pip换源

- THE END -

AffettoIris

11月23日17:58

最后修改:2023年11月23日
0

非特殊说明,本博所有文章均为博主原创。

共有 0 条评论