(Mac)PIP使用国内镜像
(Mac)PIP使用国内镜像
Section titled “(Mac)PIP使用国内镜像”PIP使用国外源安装软件包,下载速度非常慢,将PIP安装源头替换为国内镜像,可以大幅提高下载速度,提高安装成功率。
- 清华:https://pypi.tuna.tsinghua.edu.cn/simple
- 阿里云:http://mirrors.aliyun.com/pypi/simple/
- 中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
- 华中科技大学:http://pypi.hustunique.com/
- 山东理工大学:http://pypi.sdutlinux.org/
- 豆瓣:http://pypi.douban.com/simple/
2、PIP设置
Section titled “2、PIP设置”使用指定的镜像源, 可以临时指定,也可以通过修改配置文件,始终生效。
2.1、 临时使用
Section titled “2.1、 临时使用”可以在使用pip命令时,指定参数:-i
$ pip install myqr -i https://pypi.tuna.tsinghua.edu.cn/simplepip将会从清华的镜像中下载安装软件包myqr。
2.2、修改配置文件
Section titled “2.2、修改配置文件”在不同系统中,配置文件的路径不同。
- Linux/Unix/Mac OS系统,默认配置文件路径为:
$HOME/.pip/pip.conf- Windows,默认配置文件路径为:
%HOME%/pip/pip.ini注:如果默认路径下不存在配置文件,需要新建
如,使用阿里云镜像可以下面的配置:
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com