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

如何在readthedocs.yaml或requirements.txt中添加matplotlib依赖?

Read the Docs 构建缺失matplotlib的解决方法

1. 配置requirements.txt

在你项目根目录的requirements.txt文件中添加以下内容即可引入matplotlib依赖:

matplotlib

如果需要指定版本避免兼容性问题,可写成:

matplotlib==3.7.2

你项目的其他Python依赖也可按照相同格式逐行添加到该文件中。

2. 配置.readthedocs.yaml

确保你的.readthedocs.yaml中包含读取requirements.txt的配置,最小可用配置示例如下:

version: 2
build:
  os: ubuntu-22.04
  tools:
    python: "3.10"
python:
  install:
    # 读取依赖文件
    - requirements: requirements.txt
    # 若需要同时安装你自己开发的Python包,保留以下配置,否则可删除
    - method: pip
      path: .

将两个文件的修改推送到代码仓库后,重新触发Read the Docs的构建流程即可解决报错。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.10.03 00:57:02