如何在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
相关产品推荐
相关产品推荐

