Windows使用pip时报错:Read time out

Windows上使用pip安装文件时报错:Read time out
显示如下信息:

ption:
Traceback (most recent call last):
  File "C:\Python\Python35\lib\site-packages\pip-9.0.1-py3.5.egg\pip\_vendor\req
uests\packages\urllib3\response.py", line 232, in _error_catcher
    yield
  File "C:\Python\Python35\lib\site-packages\pip-9.0.1-py3.5.egg\pip\_vendor\req
uests\packages\urllib3\response.py", line 314, in read
    data = self._fp.read(amt)
  File "C:\Python\Python35\lib\site-packages\pip-9.0.1-py3.5.egg\pip\_vendor\cac
hecontrol\filewrapper.py", line 60, in read
    data = self.__fp.read(amt)
  File "C:\Python\Python35\lib\http\client.py", line 448, in read
    n = self.readinto(b)
  File "C:\Python\Python35\lib\http\client.py", line 488, in readinto
    n = self.fp.readinto(b)
  File "C:\Python\Python35\lib\socket.py", line 575, in readinto
    return self._sock.recv_into(b)
  File "C:\Python\Python35\lib\ssl.py", line 929, in recv_into
    return self.read(nbytes, buffer)
  File "C:\Python\Python35\lib\ssl.py", line 791, in read
    return self._sslobj.read(len, buffer)
  File "C:\Python\Python35\lib\ssl.py", line 575, in read
    v = 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:\Python\Python35\lib\site-packages\pip-9.0.1-py3.5.egg\pip\basecommand
.py", line 215, in main
    status = self.run(options, args)
  File "C:\Python\Python35\lib\site-packages\pip-9.0.1-py3.5.egg\pip\commands\in
stall.py", line 335, in run
    wb.build(autobuilding=True)
  File "C:\Python\Python35\lib\site-packages\pip-9.0.1-py3.5.egg\pip\wheel.py",
line 749, in build
    self.requirement_set.prepare_files(self.finder)
  File "C:\Python\Python35\lib\site-packages\pip-9.0.1-py3.5.egg\pip\req\req_set
.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "C:\Python\Python35\lib\site-packages\pip-9.0.1-py3.5.egg\pip\req\req_set
.py", line 620, in _prepare_file
    session=self.session, hashes=hashes)
  File "C:\Python\Python35\lib\site-packages\pip-9.0.1-py3.5.egg\pip\download.py
", line 821, in unpack_url
    hashes=hashes
  File "C:\Python\Python35\lib\site-packages\pip-9.0.1-py3.5.egg\pip\download.py
", line 659, in unpack_http_url
    hashes)
  File "C:\Python\Python35\lib\site-packages\pip-9.0.1-py3.5.egg\pip\download.py
", line 882, in _download_http_url
    _download_url(resp, link, content_file, hashes)
  File "C:\Python\Python35\lib\site-packages\pip-9.0.1-py3.5.egg\pip\download.py
", line 603, in _download_url
    hashes.check_against_chunks(downloaded_chunks)
  File "C:\Python\Python35\lib\site-packages\pip-9.0.1-py3.5.egg\pip\utils\hashe
s.py", line 46, in check_against_chunks
    for chunk in chunks:
  File "C:\Python\Python35\lib\site-packages\pip-9.0.1-py3.5.egg\pip\download.py
", line 571, in written_chunks
    for chunk in chunks:
  File "C:\Python\Python35\lib\site-packages\pip-9.0.1-py3.5.egg\pip\utils\ui.py
", line 139, in iter
    for x in it:
  File "C:\Python\Python35\lib\site-packages\pip-9.0.1-py3.5.egg\pip\download.py
", line 560, in resp_read
    decode_content=False):
  File "C:\Python\Python35\lib\site-packages\pip-9.0.1-py3.5.egg\pip\_vendor\req
uests\packages\urllib3\response.py", line 357, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "C:\Python\Python35\lib\site-packages\pip-9.0.1-py3.5.egg\pip\_vendor\req
uests\packages\urllib3\response.py", line 324, in read
    flush_decoder = True
  File "C:\Python\Python35\lib\contextlib.py", line 77, in __exit__
    self.gen.throw(type, value, traceback)
  File "C:\Python\Python35\lib\site-packages\pip-9.0.1-py3.5.egg\pip\_vendor\req
uests\packages\urllib3\response.py", line 237, in _error_catcher
    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
pip._vendor.requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnecti
onPool(host='pypi.python.org', port=443): Read timed out.

解决办法:
1、到 https://pypi.python.org/simple/pip/ 下载最新的.wsh文件
2、增加超时时间

pip --default-timeout=100 install -U pip

你可能感兴趣的:(Windows使用pip时报错:Read time out)