一、引言
python 中使用 pip 下载安装工具包很方便,但是有的时候下载会很慢,甚至因下载卡住而出现中断现象,采用国内镜像则能够大大提速。
二、国内镜像
http://pypi.douban.com/simple/ 豆瓣
http://mirrors.aliyun.com/pypi/simple/ 阿里
http://pypi.mirrors.ustc.edu.cn/simple/ 中科大
https://pypi.tuna.tsinghua.edu.cn/simple/ 清华
三、使用方法
1. linux 系统,在~/.pip/pip.conf (若没有此文件自行创建)中设置以下内容:
[global]
index-url=http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
windows系统则是在 C:\Users\your_user_name\pip\pip.init (若没有此文件自行创建)中设置。
2. 如果是临时使用的话,不需要配置,直接输入以下即可
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple mxnet
以上命令则会从清华的镜像库里下载安装mxnet
本文介绍如何通过使用国内镜像源加速Python环境下pip工具包的下载安装过程。提供了包括豆瓣、阿里云、清华大学等在内的多个镜像源地址,并给出了适用于Linux及Windows系统的具体配置方法。
1458

被折叠的 条评论
为什么被折叠?



