python使用pip安装模块出错 Retrying (Retr
2019-12-31 本文已影响0人
依然慢节奏
一、问题
在Python3使用pip3安装模块时,报下面错误:
Administrator@LOVE-TT MINGW64 /e/Project/oneclick/idcardcheck (master)
$ pip3 install pytesseract
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by
'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000001381AC99408>,
'Connection to pypi.org timed out. (connect timeout=15)')': /simple/pytesseract/
PS:出现该错误信息是因为
pip
源连接证书验证失败,将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/
- Windows配置
-
找到系统盘下C:\Users\用户名\AppData\Roaming目录
user
admin
appdate
-
查看Roaming文件夹下有没有一个pip文件夹,如果没有创建一个新的;
pip
-
进入pip文件夹,创建一个pip.ini文件,写入:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=mirrors.aliyun.com
- Linux安装
- 编辑~/.pip/pip.conf,如果不存在就创建,内容如下:
[global]
timeout = 10 # 设置超时,单位s
index-url = http://mirrors.aliyun.com/pypi/simple/ # 指定优先下载源
extra-index-url= http://pypi.douban.com/simple/ # 第二下载源
[install]
trusted-host=
mirrors.aliyun.com
pypi.douban.com
三、重新安装:
![](https://img.haomeiwen.com/i11736889/f16fa261772057bb.png)