python pip安裝錯誤 ConnectTimeoutError錯誤解決辦法
Traceback (most recent call last):
File "F:\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 243, in read
data = self._fp.read(amt)
File "F:\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 49, in read
data = self.__fp.read(amt)
File "f:\lib\http\client.py", line 433, in read
n = self.readinto(b)
File "f:\lib\http\client.py", line 473, in readinto
n = self.fp.readinto(b)
File "f:\lib\socket.py", line 575, in readinto
return self._sock.recv_into(b)
File "f:\lib\ssl.py", line 924, in recv_into
return self.read(nbytes, buffer)
File "f:\lib\ssl.py", line 786, in read
return self._sslobj.read(len, buffer)
File "f:\lib\ssl.py", line 570, 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 "F:\lib\site-packages\pip\basecommand.py", line 211, in main
status = self.run(options, args)
File "F:\lib\site-packages\pip\commands\install.py", line 294, in run
requirement_set.prepare_files(finder)
File "F:\lib\site-packages\pip\req\req_set.py", line 334, in prepare_files
functools.partial(self._prepare_file, finder))
File "F:\lib\site-packages\pip\req\req_set.py", line 321, in _walk_req_to_install
more_reqs = handler(req_to_install)
File "F:\lib\site-packages\pip\req\req_set.py", line 491, in _prepare_file
session=self.session)
File "F:\lib\site-packages\pip\download.py", line 825, in unpack_url
session,
File "F:\lib\site-packages\pip\download.py", line 673, in unpack_http_url
from_path, content_type = _download_http_url(link, session, temp_dir)
File "F:\lib\site-packages\pip\download.py", line 886, in _download_http_url
_download_url(resp, link, content_file)
File "F:\lib\site-packages\pip\download.py", line 621, in _download_url
for chunk in progress_indicator(resp_read(4096), 4096):
File "F:\lib\site-packages\pip\utils\ui.py", line 133, in iter
for x in it:
File "F:\lib\site-packages\pip\download.py", line 586, in resp_read
decode_content=False):
File "F:\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 307, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "F:\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 258, in read
raise ReadTimeoutError(self._pool, None, 'Read timed out.')
pip._vendor.requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out.
使用映象:pip install xxxx -i https://pypi.douban.com/simple 如下:
pip install virtualenv -i https://pypi.douban.com/simple