处理 pip install xxxx 出现红色警告

python 专栏收录该内容
2 篇文章 0 订阅

在进行pip install xxxx 操作时,出现了一下情况:

C:\Users\MXSYS-2>pip install requests
Collecting requests
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/1a/70/1935c770cb3be6e3a8b78ced23d7e0f3b187f5cbfab4749523ed65d7c9b1/requests-2.23.0-py2.py3-none-any.whl
  Downloading https://files.pythonhosted.org/packages/1a/70/1935c770cb3be6e3a8b78ced23d7e0f3b187f5cbfab4749523ed65d7c9b1/requests-2.23.0-py2.py3-none-any.whl (58kB)
     |███████████                     | 20kB 2.9kB/s eta 0:00:14ERROR: Exception:
Traceback (most recent call last):
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\urllib3\response.py", line 397, in _error_catcher
    yield
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\urllib3\response.py", line 479, in read
    data = self._fp.read(amt)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 62, in read
    data = self.__fp.read(amt)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\http\client.py", line 454, in read
    n = self.readinto(b)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\http\client.py", line 498, in readinto
    n = self.fp.readinto(b)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\socket.py", line 669, in readinto
    return self._sock.recv_into(b)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\cli\base_command.py", line 188, in main
    status = self.run(options, args)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\commands\install.py", line 345, in run
    resolver.resolve(requirement_set)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\legacy_resolve.py", line 196, in resolve
    self._resolve_one(requirement_set, req)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\legacy_resolve.py", line 359, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\legacy_resolve.py", line 305, in _get_abstract_dist_for
    abstract_dist = self.preparer.prepare_linked_requirement(
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\operations\prepare.py", line 195, in prepare_linked_requirement
    unpack_url(
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\download.py", line 1058, in unpack_url
    unpack_http_url(
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\download.py", line 920, in unpack_http_url
    from_path, content_type = _download_http_url(link,
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\download.py", line 1152, in _download_http_url
    _download_url(resp, link, content_file, hashes, progress_bar)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\download.py", line 861, in _download_url
    hashes.check_against_chunks(downloaded_chunks)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\utils\hashes.py", line 75, in check_against_chunks
    for chunk in chunks:
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\download.py", line 829, in written_chunks
    for chunk in chunks:
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\utils\ui.py", line 156, in iter
    for x in it:
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\download.py", line 794, in resp_read
    for chunk in resp.raw.stream(
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\urllib3\response.py", line 531, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\urllib3\response.py", line 496, in read
    raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\urllib3\response.py", line 402, in _error_catcher
    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

就很绝望。

然后看了其他大佬,又进行了一下操作:

C:\Users\MXSYS-2>pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl (1.4MB)
     |                                | 10kB 507bytes/s eta 0:46:59ERROR: Exception:
Traceback (most recent call last):
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\urllib3\response.py", line 397, in _error_catcher
    yield
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\urllib3\response.py", line 479, in read
    data = self._fp.read(amt)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 62, in read
    data = self.__fp.read(amt)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\http\client.py", line 454, in read
    n = self.readinto(b)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\http\client.py", line 498, in readinto
    n = self.fp.readinto(b)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\socket.py", line 669, in readinto
    return self._sock.recv_into(b)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\cli\base_command.py", line 188, in main
    status = self.run(options, args)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\commands\install.py", line 345, in run
    resolver.resolve(requirement_set)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\legacy_resolve.py", line 196, in resolve
    self._resolve_one(requirement_set, req)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\legacy_resolve.py", line 359, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\legacy_resolve.py", line 305, in _get_abstract_dist_for
    abstract_dist = self.preparer.prepare_linked_requirement(
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\operations\prepare.py", line 195, in prepare_linked_requirement
    unpack_url(
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\download.py", line 1058, in unpack_url
    unpack_http_url(
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\download.py", line 920, in unpack_http_url
    from_path, content_type = _download_http_url(link,
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\download.py", line 1152, in _download_http_url
    _download_url(resp, link, content_file, hashes, progress_bar)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\download.py", line 861, in _download_url
    hashes.check_against_chunks(downloaded_chunks)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\utils\hashes.py", line 75, in check_against_chunks
    for chunk in chunks:
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\download.py", line 829, in written_chunks
    for chunk in chunks:
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\utils\ui.py", line 156, in iter
    for x in it:
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\download.py", line 794, in resp_read
    for chunk in resp.raw.stream(
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\urllib3\response.py", line 531, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\urllib3\response.py", line 496, in read
    raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\urllib3\response.py", line 402, in _error_catcher
    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

还是不行。。。汗
然后进行了easy install

C:\Users\MXSYS-2>easy_install pip
Searching for pip
Best match: pip 19.2.3
Adding pip 19.2.3 to easy-install.pth file
Installing pip-script.py script to c:\users\mxsys-2\appdata\local\programs\python\python38-32\Scripts
Installing pip.exe script to c:\users\mxsys-2\appdata\local\programs\python\python38-32\Scripts
Installing pip.exe.manifest script to c:\users\mxsys-2\appdata\local\programs\python\python38-32\Scripts
Installing pip3-script.py script to c:\users\mxsys-2\appdata\local\programs\python\python38-32\Scripts
Installing pip3.exe script to c:\users\mxsys-2\appdata\local\programs\python\python38-32\Scripts
Installing pip3.exe.manifest script to c:\users\mxsys-2\appdata\local\programs\python\python38-32\Scripts
Installing pip3.7-script.py script to c:\users\mxsys-2\appdata\local\programs\python\python38-32\Scripts
Installing pip3.7.exe script to c:\users\mxsys-2\appdata\local\programs\python\python38-32\Scripts
Installing pip3.7.exe.manifest script to c:\users\mxsys-2\appdata\local\programs\python\python38-32\Scripts

Using c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages
Processing dependencies for pip
Finished processing dependencies for pip

好像有一线希望!

C:\Users\MXSYS-2>pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl (1.4MB)
ERROR: Exception:
Traceback (most recent call last):
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\urllib3\response.py", line 397, in _error_catcher
    yield
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\urllib3\response.py", line 479, in read
    data = self._fp.read(amt)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 62, in read
    data = self.__fp.read(amt)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\http\client.py", line 454, in read
    n = self.readinto(b)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\http\client.py", line 498, in readinto
    n = self.fp.readinto(b)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\socket.py", line 669, in readinto
    return self._sock.recv_into(b)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\cli\base_command.py", line 188, in main
    status = self.run(options, args)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\commands\install.py", line 345, in run
    resolver.resolve(requirement_set)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\legacy_resolve.py", line 196, in resolve
    self._resolve_one(requirement_set, req)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\legacy_resolve.py", line 359, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\legacy_resolve.py", line 305, in _get_abstract_dist_for
    abstract_dist = self.preparer.prepare_linked_requirement(
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\operations\prepare.py", line 195, in prepare_linked_requirement
    unpack_url(
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\download.py", line 1058, in unpack_url
    unpack_http_url(
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\download.py", line 920, in unpack_http_url
    from_path, content_type = _download_http_url(link,
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\download.py", line 1152, in _download_http_url
    _download_url(resp, link, content_file, hashes, progress_bar)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\download.py", line 861, in _download_url
    hashes.check_against_chunks(downloaded_chunks)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\utils\hashes.py", line 75, in check_against_chunks
    for chunk in chunks:
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\download.py", line 829, in written_chunks
    for chunk in chunks:
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\utils\ui.py", line 156, in iter
    for x in it:
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\download.py", line 794, in resp_read
    for chunk in resp.raw.stream(
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\urllib3\response.py", line 531, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\urllib3\response.py", line 496, in read
    raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "c:\users\mxsys-2\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\urllib3\response.py", line 402, in _error_catcher
    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

尝试update还是不行

最后我还是用了镜像!

C:\Users\MXSYS-2>pip install requests -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
Looking in indexes: http://pypi.douban.com/simple
Collecting requests
  Downloading http://pypi.doubanio.com/packages/1a/70/1935c770cb3be6e3a8b78ced23d7e0f3b187f5cbfab4749523ed65d7c9b1/requests-2.23.0-py2.py3-none-any.whl (58kB)
     |████████████████████████████████| 61kB 3.8MB/s
Collecting chardet<4,>=3.0.2 (from requests)
  Downloading http://pypi.doubanio.com/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
     |████████████████████████████████| 143kB 3.3MB/s
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests)
  Downloading http://pypi.doubanio.com/packages/e8/74/6e4f91745020f967d09332bb2b8b9b10090957334692eb88ea4afe91b77f/urllib3-1.25.8-py2.py3-none-any.whl (125kB)
     |████████████████████████████████| 133kB 6.8MB/s
Collecting idna<3,>=2.5 (from requests)
  Downloading http://pypi.doubanio.com/packages/89/e3/afebe61c546d18fb1709a61bee788254b40e736cff7271c7de5de2dc4128/idna-2.9-py2.py3-none-any.whl (58kB)
     |████████████████████████████████| 61kB 3.8MB/s
Collecting certifi>=2017.4.17 (from requests)
  Downloading http://pypi.doubanio.com/packages/b9/63/df50cac98ea0d5b006c55a399c3bf1db9da7b5a24de7890bc9cfd5dd9e99/certifi-2019.11.28-py2.py3-none-any.whl (156kB)
     |████████████████████████████████| 163kB 6.4MB/s
Installing collected packages: chardet, urllib3, idna, certifi, requests
Successfully installed certifi-2019.11.28 chardet-3.0.4 idna-2.9 requests-2.23.0 urllib3-1.25.8
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

终于解决了!!

  • 0
    点赞
  • 1
    评论
  • 1
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

©️2021 CSDN 皮肤主题: 1024 设计师:白松林 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值