2019年4月20日星期六

设置pypi镜像

修改镜像源在不同操作系统中,修改文件的位置是不同的,
在linux默认的路径是:$HOME/.pip/pip.conf
在windows默认的路径是:%HOME%\pip\pip.ini

默认路径下并不存在配置文件,需要新建,然后在配置文件中写入:
[global]
index-url = http://pypi.mirrors.ustc.edu.cn/simple/

阿里云 速度最快 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) http://pypi.douban.com/simple/
Python官方 https://pypi.python.org/simple/
v2ex http://pypi.v2ex.com/simple/
中国科学院 http://pypi.mirrors.opencas.cn/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/

也可以直接使用用-i指令指定镜像源下载,不过这样每次下载库都要加上镜像网址,如下。

pip install -i http://mirrors.aliyun.com/pypi/simple/ pyqt5
pip install -i http://mirrors.aliyun.com/pypi/simple/ pyqt5-tools
pip install -i http://mirrors.aliyun.com/pypi/simple/ qscintilla

没有评论: