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

安装Matplotlib包时出现ReadTimeoutError,请求解决

解决Matplotlib安装超时问题

报错信息

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/17/91/febbb6c1063ae05a62fdbe038c2917b348b1b35f0482cee4738e6870a44a/matplotlib-3.9.0-cp312-cp312-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/17/91/febbb6c1063ae05a62fdbe038c2917b348b1b35f0482cee4738e6870a44a/matplotlib-3.9.0-cp312-cp312-win_amd64.whl.metadata (Caused by ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)"))

解决方法

  • 延长pip超时时间
    执行安装命令时增加超时参数,给下载过程预留更长时间:

    pip install matplotlib --default-timeout=100
    
  • 使用国内PyPI镜像源
    国内镜像服务器响应更快,能有效避免连接国外服务器超时,推荐使用以下镜像:

    # 清华镜像
    pip install matplotlib -i https://pypi.tuna.tsinghua.edu.cn/simple
    # 阿里云镜像
    pip install matplotlib -i https://mirrors.aliyun.com/pypi/simple/
    # 同时结合超时参数
    pip install matplotlib -i https://pypi.tuna.tsinghua.edu.cn/simple --default-timeout=100
    
  • 手动下载whl文件安装

    1. 找到匹配你Python版本和系统的whl文件(比如你需要的matplotlib-3.9.0-cp312-cp312-win_amd64.whl)
    2. 下载到本地后,执行本地安装命令:
    pip install C:\path\to\matplotlib-3.9.0-cp312-cp312-win_amd64.whl
    

    注意替换路径为你实际的文件存储位置。

  • 检查网络环境
    暂时关闭代理工具、防火墙或杀毒软件,确保网络连接稳定后再尝试安装。

内容的提问来源于stack exchange,提问作者Mahdi Bd

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.22 18:27:13