Python 清华镜像设置

大家在通过pip 或conda 下载一些很大的第三方库时是不是有一种等到坟头的草都三尺高了,还没下载完的感觉,而且大的第三方库长时间下载,可能会导致超时自动中断下载,感谢清华的大佬们

临时使用:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow

每次下载时,默认使用此镜像:

  需将pip升级到最新的版本,>=10.0.0

pip install pip -U

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

有问题请留言,欢迎指点!!!

今天又试了一下发现有问题。

如果以上方法不行的话:

请使用:

转自:https://www.cnblogs.com/cqliu/p/11131092.html

国内镜像源

清华: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/

临时使用

 在使用pip的时候加参数-i https://pypi.tuna.tsinghua.edu.cn/simple
例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyspider,这样就会从清华这边的镜像去安装pyspider库。

一劳永逸

 Linux下,修改 ~/.pip/pip.conf (没有就创建一个文件夹及文件。文件夹要加“.”,表示是隐藏文件夹)

内容如下:

[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com

windows下,直接在user目录中创建一个pip目录,如:C:Usersxxpip,新建文件pip.ini。内容同上。

本机win10操作系统,目录:C:UsersDELLAppDataRoamingpippip.ini

遇到的问题

实际使用的时候,一开始使用清华的镜像,在安装时,总是提示

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

换了阿里的镜像之后,问题得到了解决。

以后会持续更新。

https://www.cnblogs.com/zhangzhixing/
原文地址:https://www.cnblogs.com/zhangzhixing/p/12048269.html