Python资源安装过程出现Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None))…………

问题:安装包出现Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError

解决办法: pip install selectivesearch -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

其他源总结:

搜集了一些国内的pip源,如下:

阿里云 http://mirrors.aliyun.com/pypi/simple/

中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/

豆瓣(douban) http://pypi.douban.com/simple/ 

清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/

中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/

使用方法很简单,直接 -i 加 url 即可!如下:

 如果有报错:

使用命令:# pip install pandas  -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

如果想配置成默认的源,方法如下:

需要创建或修改配置文件(一般都是创建),

linux的文件在~/.pip/pip.conf,

windows在%HOMEPATH%\pip\pip.ini),

修改内容为:

11 [global] 22 index-url = http://pypi.douban.com/simple 3 [install] 4 trusted-host=pypi.douban.com

这样在使用pip来安装时,会默认调用该镜像。

临时使用其他源安装软件包的python脚本如下:

 

11 #!/usr/bin/python 22 import os 33 package = raw_input("Please input the package which you want to install!\n") 44 55 command = "pip install %s -i http://pypi.mirrors.ustc.edu.cn/simple --trusted-host pypi.mirrors.ustc.edu.cn" % package 66 os.system(command)
点赞
收藏

评论区

加载中...

相关推荐

python-`if not x:` 和`if x is not None:`和`if not x is None:`使用

代码中经常会有变量是否为None的判断,有三种主要的写法:第一种是ifxisNone;第二种是ifnotx:;第三种是ifnotxisNone(这句这样理解更清晰ifnot(xisNone))。如果你觉得这样写没啥区别,那么你可就要小心了,这里面有一个坑。先来看一下代码:x1notxFalse

让元素不能被复制

cssmozuserselect:none;/火狐/webkituserselect:none;/webkit浏览器/msuserselect:none;/IE10/khtmluserselect:none;/早期浏览器/userselect:none;

java反射, 不看你可别后悔

<divid"content\_views"class"markdown\_views"<!flowchart箭头图标勿删<svgxmlns"http://www.w3.org/2000/svg"style"display:none;"<pathstrokelinecap"round"d"M5,00,

.pip的时候出现Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None))…………

pip的幺蛾子:有时候在用pip安装python中的包的时候,会出先请求失败的现象,一开始还以为是自己的网不够好,后来才发现。。。。。。原因:pip的下载源存在国外和国内之分,一般来说国内的源下载会块很多,国外的源会有速度限制,从而造成请求失败从而不能安装你想要的模块.解决方法:几种国内常用的pip源阿里云:http://mirro

AndroidStudio封装SDK的那些事

<divclass"markdown\_views"<!flowchart箭头图标勿删<svgxmlns"http://www.w3.org/2000/svg"style"display:none;"<pathstrokelinecap"round"d"M5,00,2.55,5z"id"raphael

Native memory allocation (mmap) failed to map xxx bytes for committing reserved memory

<divid"content\_views"class"markdown\_views"<!flowchart箭头图标勿删<svgxmlns"http://www.w3.org/2000/svg"style"display:none;"<pathstrokelinecap"round"d"M5,00,