You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在CMD中安装pandas模块时出现HTTPS连接超时错误求助

解决pip安装pandas时的ReadTimeoutError问题

问题场景

执行python -m pip install pandas安装pandas模块时,多次触发ReadTimeoutError重试警告,最终因超出最大重试次数安装失败。

报错截图

pip安装pandas超时报错

命令行报错输出

python -m pip install pandas
Collecting pandas
  Obtaining dependency information for pandas from https://files.pythonhosted.org/packages/b7/f8/32d6b5aa4c4bc045fa2c4c58f88c325facc54721956c6313f0afea8ea853/pandas-2.1.0-cp311-cp311-win_amd64.whl.metadata
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/b7/f8/32d6b5aa4c4bc045fa2c4c58f88c325facc54721956c6313f0afea8ea853/pandas-2.1.0-cp311-cp311-win_amd64.whl.metadata
  WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/b7/f8/32d6b5aa4c4bc045fa2c4c58f88c325facc54721956c6313f0afea8ea853/pandas-2.1.0-cp311-cp311-win_amd64.whl.metadata
  WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/b7/f8/32d6b5aa4c4bc045fa2c4c58f88c325facc54721956c6313f0afea8ea853/pandas-2.1.0-cp311-cp311-win_amd64.whl.metadata
  WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/b7/f8/32d6b5aa4c4bc045fa2c4c58f88c325facc54721956c6313f0afea8ea853/pandas-2.1.0-cp311-cp311-win_amd64.whl.metadata
  WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/b7/f8/32d6b5aa4c4bc045fa2c4c58f88c325facc54721956c6313f0afea8ea853/pandas-2.1.0-cp311-cp311-win_amd64.whl.metadata
ERROR: Could not install packages due to an OSError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/b7/f8/32d6b5aa4c4bc045fa2c4c58f88c325facc54721956c6313f0afea8ea853/pandas-2.1.0-cp311-cp311-win_amd64.whl.metadata (Caused by ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)"))

有效解决方法

1. 使用国内PyPI镜像源安装

国内镜像源速度更快,避免超时。执行以下命令:

# 临时使用阿里云源安装pandas
python -m pip install pandas -i https://mirrors.aliyun.com/pypi/simple/

# 或使用清华源
python -m pip install pandas -i https://pypi.tuna.tsinghua.edu.cn/simple/

如果需要长期使用镜像源,可在用户目录下创建pip\pip.ini(Windows)或~/.pip/pip.conf(Linux/macOS),写入以下内容:

[global]
index-url = https://mirrors.aliyun.com/pypi/simple/

2. 延长pip超时时间

通过--default-timeout参数延长连接和读取的超时时间,给下载更多缓冲时间:

python -m pip install pandas --default-timeout=100

3. 手动下载whl文件安装

  • 找到对应Python版本(如cp311对应Python3.11)和系统架构(win_amd64对应64位Windows)的pandas whl文件下载
  • 打开CMD,进入下载文件所在目录,执行安装命令:
python -m pip install pandas-2.1.0-cp311-cp311-win_amd64.whl

4. 升级pip到最新版本

旧版pip可能存在兼容性问题,先升级pip再尝试安装:

python -m pip install --upgrade pip

内容的提问来源于stack exchange,提问作者Sepehr Ghadiri

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.11 04:34:54