python更换国内源

python安装以后默认是使用国外的源,使用pip下载模块网速不是很好,有时候下到一半还会断开链接,很是不方便,最好配置国内的源。html

 

Windows下:python

在Windows配置源可参考下面两个博客:url

http://www.javashuo.com/article/p-yepcunxo-hw.html.net

https://blog.csdn.net/gz_liuyun/article/details/52778198htm

在本机User目录下的目录AppData,找到pip文件夹 ,例如C:\Users\cnblog\AppData\Local\pipblog

新建一个pip.ini文件ip

[global]

timeout = 6000

index-url = http://pypi.douban.com/simple

trusted-host = http://pypi.douban.comget

 

如今国内用的最多的就是http://pypi.douban.com/simple博客

 

在Linux下须要找到pip.confit

通常位置在·~/.pip/pip.conf,可是也有例外,须要用find查找找,个人就在/root下面

找到以后修改文件内容:

[global]

timeout =6000

index-url =http://pypi.douban.com/simple/

[install]

use-mirrors =true

mirrors =http://pypi.douban.com/simple/

trusted-host =pypi.douban.com

相关文章
相关标签/搜索