pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host=‘files.pythonhosted.org’, port=443): Read timed out
- pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host=‘files.pythonhosted.org’, port=443): Read timed out.
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/pip/_internal/cli/base_command.py", line 178, in main
status = self.run(options, args)
File "/usr/local/lib/python3.5/dist-packages/pip/_internal/commands/install.py", line 352, in run
resolver.resolve(requirement_set)
File "/usr/local/lib/python3.5/dist-packages/pip/_internal/resolve.py", line 131, in resolve
self._resolve_one(requirement_set, req)
File "/usr/local/lib/python3.5/dist-packages/pip/_internal/resolve.py", line 294, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/usr/local/lib/python3.5/dist-packages/pip/_internal/resolve.py", line 242, in _get_abstract_dist_for
self.require_hashes
File "/usr/local/lib/python3.5/dist-packages/pip/_internal/operations/prepare.py", line 347, in prepare_linked_requirement
progress_bar=self.progress_bar
File "/usr/local/lib/python3.5/dist-packages/pip/_internal/download.py", line 886, in unpack_url
progress_bar=progress_bar
File "/usr/local/lib/python3.5/dist-packages/pip/_internal/download.py", line 746, in unpack_http_url
progress_bar)
File "/usr/local/lib/python3.5/dist-packages/pip/_internal/download.py", line 954, in _download_http_url
_download_url(resp, link, content_file, hashes, progress_bar)
File "/usr/local/lib/python3.5/dist-packages/pip/_internal/download.py", line 683, in _download_url
hashes.check_against_chunks(downloaded_chunks)
File "/usr/local/lib/python3.5/dist-packages/pip/_internal/utils/hashes.py", line 62, in check_against_chunks
for chunk in chunks:
File "/usr/local/lib/python3.5/dist-packages/pip/_internal/download.py", line 651, in written_chunks
for chunk in chunks:
File "/usr/local/lib/python3.5/dist-packages/pip/_internal/utils/ui.py", line 156, in iter
for x in it:
File "/usr/local/lib/python3.5/dist-packages/pip/_internal/download.py", line 640, in resp_read
decode_content=False):
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/urllib3/response.py", line 494, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/urllib3/response.py", line 459, in read
raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
File "/usr/lib/python3.5/contextlib.py", line 77, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/urllib3/response.py", line 365, 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.
yongqiang@famu-sys:~$
安装超时
网络原因导致的安装超时,重新下载。
设置超时时间延长后重新下载。
下载命令后添加参数 --default-timeout=1000,时间可以自定义。
pip install 默认超时时间是 15s,在安装的过程中可能会超时。在执行命令时,可显式指定超时时间。
–default-timeout=100
–default-timeout=1000
sudo pip3 --default-timeout=100 install opencv-python==3.4.0.14
sudo pip3 --default-timeout=1000 install opencv-python==3.4.0.14
更换安装源。
清华大学开源软件镜像 https://mirrors.tuna.tsinghua.edu.cn/
https://pypi.tuna.tsinghua.edu.cn/simple
sudo pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple scipy
sudo pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple scikit-learn
豆瓣开源镜像
https://pypi.douban.com/simple
sudo pip3 install -i https://pypi.douban.com/simple scipy
sudo pip3 install -i https://pypi.douban.com/simple scikit-learn