背景
镜像源本质上是从开源软件的软件包库中同步过来的镜像,在国内用镜像可以加速开源软件的下载.
常见国内镜像源
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
华中科技大学http://pypi.hustunique.com/
豆瓣http://pypi.douban.com/simple/
阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
国内镜像源搭建过程
- 临时使用
在终端中输入以下命令:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pandas
- 永久修改
Linux下:修改 ~/.pip/pip.conf,以清华镜像为例 (没有就创建一个文件夹及文件。文件夹要加“.”,表示是隐藏文件夹)
内容如下:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = https://pypi.tuna.tsinghua.edu.cn