pip安装软件遇到了SSLError: The read operation timed out问题
Exception:
Traceback (most recent call last):
File “/usr/lib/python2.7/dist-packages/pip/basecommand.py”, line 122, in main
status = self.run(options, args)
File “/usr/lib/python2.7/dist-packages/pip/commands/install.py”, line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File “/usr/lib/python2.7/dist-packages/pip/req.py”, line 1097, in prepare_files
req_to_install, self.upgrade)
File “/usr/lib/python2.7/dist-packages/pip/index.py”, line 194, in find_requirement
page = self._get_page(main_index_url, req)
File “/usr/lib/python2.7/dist-packages/pip/index.py”, line 568, in _get_page
session=self.session,
File “/usr/lib/python2.7/dist-packages/pip/index.py”, line 670, in get_page
resp = session.get(url, headers={“Accept”: “text/html”})
File “/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/sessions.py”, line 479, in get
return self.request(‘GET’, url, **kwargs)
File “/usr/lib/python2.7/dist-packages/pip/download.py”, line 237, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File “/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/sessions.py”, line 467, in request
resp = self.send(prep, **send_kwargs)
File “/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/sessions.py”, line 590, in send
history = [resp for resp in gen] if allow_redirects else []
File “/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/sessions.py”, line 194, in resolve_redirects
allow_redirects=False,
File “/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/sessions.py”, line 570, in send
r = adapter.send(request, **kwargs)
File “/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/adapters.py”, line 394, in send
r.content
File “/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/models.py”, line 679, in content
self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes()
File “/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/models.py”, line 616, in generate
decode_content=True):
File “/usr/share/python-wheels/urllib3-1.7.1-py2.py3-none-any.whl/urllib3/response.py”, line 225, in stream
data = self.read(amt=amt, decode_content=decode_content)
File “/usr/share/python-wheels/urllib3-1.7.1-py2.py3-none-any.whl/urllib3/response.py”, line 174, in read
data = self._fp.read(amt)
File “/usr/lib/python2.7/httplib.py”, line 602, in read
s = self.fp.read(amt)
File “/usr/lib/python2.7/socket.py”, line 380, in read
data = self._sock.recv(left)
File “/usr/lib/python2.7/ssl.py”, line 341, in recv
return self.read(buflen)
File “/usr/lib/python2.7/ssl.py”, line 260, in read
return self._sslobj.read(len)
SSLError: The read operation timed out
Storing debug log for failure in /home/simon/.pip/pip.log
大多是pip没有升级的造成的
sudo pip install --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple pip
sudo pip3 install --upgrade -i ttps://pypi.tuna.tsinghua.edu.cn/simple pip