升级pip超时 python -m pip install --upgrade pip 报 socket.timeout: The read operation timed out

升级pip超时 python -m pip install --upgrade pip 报 socket.timeout: The read operation timed out 

C:\Users\Acer>python -m pip install --upgrade pip
Collecting pip
  Downloading pip-20.2.2-py2.py3-none-any.whl (1.5 MB)
     |████                            | 174 kB 2.1 kB/s eta 0:10:48ERROR: Exception:
Traceback (most recent call last):
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_vendor\urllib3\response.py", line 425, in _error_catcher
    yield
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_vendor\urllib3\response.py", line 507, in read
    data = self._fp.read(amt) if not fp_closed else b""
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 62, in read
    data = self.__fp.read(amt)
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 454, in read
    n = self.readinto(b)
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 498, in readinto
    n = self.fp.readinto(b)
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python38\lib\socket.py", line 669, in readinto
    return self._sock.recv_into(b)
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python38\lib\ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python38\lib\ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

使用 python -m pip install --upgrade pip 更新升级pip的时候,因为超时出错了。

解决方法是沿用之前我总结的一个通用的设置超时时间:详情请移步 pip install ** , 设置超时 timeout 时间

python -m pip --default-timeout=800 install --upgrade pip

猜你喜欢

转载自blog.csdn.net/c_lanxiaofang/article/details/108347234
今日推荐