天天看点

pip 安装库失败问题:Retrying (Retry(total=4, connect=None, read=None, redirect=None, status =None)),原因及解决办法

本想用安装一个 requests 库,发现安装报错了。看报错日志感觉是连接它的 pypi 库下载官网有问题,使用默认的 pip 库下载地址安装本来就很慢。

我就试了试,改了个阿里云的镜像地址,然后就好了,速度也变快了。

pip安装python库秒速下载:更改pip数据源。阿里云国外镜像。 报错信息:

C:\Users\Administrator>pip install requests
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status
=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.con
nection.VerifiedHTTPSConnection object at 0x0354AE90>: Failed to establish a new
 connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。',)': /simple/re
quests/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status
=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.con
nection.VerifiedHTTPSConnection object at 0x03563D70>: Failed to establish a new
 connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。',)': /simple/re
quests/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status
=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.con
nection.VerifiedHTTPSConnection object at 0x03563F30>: Failed to establish a new
 connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。',)': /simple/re
quests/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status
=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.con
nection.VerifiedHTTPSConnection object at 0x03563A30>: Failed to establish a new
 connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。',)': /simple/re
quests/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status
=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.con
nection.VerifiedHTTPSConnection object at 0x03563950>: Failed to establish a new
 connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。',)': /simple/re
quests/
ERROR: Could not find a version that satisfies the requirement requests (from ve
rsions: none)
ERROR: No matching distribution found for requests      

改完镜像后的效果图:

C:\Users\Administrator>pip install requests
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting requests
  Downloading https://mirrors.aliyun.com/pypi/packages/51/bd/23c926cd341ea6b7dd0
b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl (
57kB)
     |█████████████████               | 30kB 2.0MB/s eta 0:00:0
     |██████████████████████▌         | 40kB 2.7MB/s eta
     |████████████████████████████    | 51kB 3.4MB/s
     |████████████████████████████████| 61kB 4.1
MB/s
Collecting certifi>=2017.4.17
  Downloading https://mirrors.aliyun.com/pypi/packages/b9/63/df50cac98ea0d5b006c
55a399c3bf1db9da7b5a24de7890bc9cfd5dd9e99/certifi-2019.11.28-py2.py3-none-any.wh
l (156kB)
     |█████████████████               | 81kB 5.5MB/s eta 0:00:0
     |███████████████████             | 92kB 6.1MB/s eta 0:00
     |█████████████████████           | 102kB 6.8MB/s eta 0
     |███████████████████████         | 112kB 6.8MB/s eta
     |█████████████████████████       | 122kB 6.8MB/s e
     |███████████████████████████     | 133kB 6.8MB/s
     |█████████████████████████████▌  | 143kB 6.8M
     |███████████████████████████████▌| 153kB 6.
     |████████████████████████████████| 163kB 6.
8MB/s
Collecting chardet<3.1.0,>=3.0.2
  Downloading https://mirrors.aliyun.com/pypi/packages/bc/a9/01ffebfb562e4274b64
87b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (13
3kB)
     |████████████████████████▌       | 102kB 6.8MB/s e
     |███████████████████████████     | 112kB 6.8MB/s
     |█████████████████████████████▌  | 122kB 6.8M
     |████████████████████████████████| 133kB 6.
     |████████████████████████████████| 143kB 6.
8MB/s
Collecting idna<2.9,>=2.5
  Downloading https://mirrors.aliyun.com/pypi/packages/14/2c/cd551d81dbe15200be1
cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl (58kB)
     |████████████████████████████████| 61kB ...

Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in d:\pyt
hon\lib\site-packages (from requests) (1.25.3)
Installing collected packages: certifi, chardet, idna, requests
Successfully installed certifi-2019.11.28 chardet-3.0.4 idna-2.8 requests-2.22.0      

喜欢的点个赞❤吧!