pip install 自定义镜像源加速安装

浏览量:

pip install 自定义镜像源加速安装

方法一

通过pip -i参数 临时指定源地址。

例如:

1
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package

方法二

  1. 编辑配置文件 ~/.pip/pip.conf ,如果没有这个文件就手动创建。

    添加下面配置:

1
2
3
4
[global] 
index-url = https://pypi.tuna.tsinghua.edu.cn/simple/
[install] 
trusted-host = pypi.tuna.tsinghua.edu.cn
  1. 或者使用命令添加:
1
2
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/
pip config set install.trusted-host pypi.tuna.tsinghua.edu.cn

pip 国内的一些镜像源地址

参考资料

https://mirrors.tuna.tsinghua.edu.cn/help/pypi/

Licensed under CC BY-NC-SA 4.0