python - 如何用 pip 解决 ReadTimeoutError : HTTPSConnectionPool(host ='pypi.python.org' , port=443)?

标签 python pip

我最近需要安装一些包

pip install future
pip install scikit-learn
pip install numpy
pip install scipy

我也试过在他们之前写 sudo ,但它在红线中出现了以下错误:

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 290, 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 1198, in prepare_files
    do_download,
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1376, in unpack_url
    self.session,
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 572, in unpack_http_url
    download_hash = _download_url(resp, link, temp_location)
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 433, in _download_url
    for chunk in resp_read(4096):
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 421, in resp_read
    chunk_size, decode_content=False):
  File "/usr/lib/python2.7/dist-packages/urllib3/response.py", line 256, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "/usr/lib/python2.7/dist-packages/urllib3/response.py", line 201, in read
    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out.

Storing debug log for failure in /root/.pip/pip.log'

最佳答案

在安装中使用 --default-timeout=100 参数:

sudo pip install --default-timeout=100 future

关于python - 如何用 pip 解决 ReadTimeoutError : HTTPSConnectionPool(host ='pypi.python.org' , port=443)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43298872/

相关文章:

python - 有没有办法在我自己的python项目中自动检测所需的模块和包

python - 如何将自定义 CA Root 证书添加到 Windows 中 pip 使用的 CA Store?

python - 调用"pygame.error: video system not initialized"后为"pygame.event.get()"

python - 创建字典,其中键是变量名

python - 显示一个八进制值作为它的字符串表示

python - 嗖嗖功能

python - 如何在 anaconda 中将 pip 版本从 10.0.1 升级到 18.0?

python - 无法使用 angularjs 调用 python 文件输出

python - pip 安装失败 - 错误 : IPython requires Python version 2. 7 或 3.3 或更高版本

python - 自动更新python脚本