python-sphinx - Sphinx 在构建 readthedocs 项目时找不到 linuxdoc
问题描述
我正在使用 readthedocs 创建一些文档。我可以在本地制作 html 文件,当我用浏览器打开 html 文件时,文档看起来完全符合我的要求。因此,我将源推送到 github 并尝试在那里构建项目 - 但失败并出现以下错误:
Running Sphinx v4.1.2
loading translations [en]... done
Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/compas-docs-readthedocs/envs/latest/lib/python3.7/site-packages/sphinx/registry.py", line 429, in load_extension
mod = import_module(extname)
File "/home/docs/checkouts/readthedocs.org/user_builds/compas-docs-readthedocs/envs/latest/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'linuxdoc'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/compas-docs-readthedocs/envs/latest/lib/python3.7/site-packages/sphinx/cmd/build.py", line 279, in build_main
args.tags, args.verbosity, args.jobs, args.keep_going)
File "/home/docs/checkouts/readthedocs.org/user_builds/compas-docs-readthedocs/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 237, in __init__
self.setup_extension(extension)
File "/home/docs/checkouts/readthedocs.org/user_builds/compas-docs-readthedocs/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 393, in setup_extension
self.registry.load_extension(self, extname)
File "/home/docs/checkouts/readthedocs.org/user_builds/compas-docs-readthedocs/envs/latest/lib/python3.7/site-packages/sphinx/registry.py", line 433, in load_extension
err) from err
sphinx.errors.ExtensionError: Could not import extension linuxdoc.rstFlatTable (exception: No module named 'linuxdoc')
Extension error:
Could not import extension linuxdoc.rstFlatTable (exception: No module named 'linuxdoc')
我正在使用 linuxdoc.rstFlatTable 模块。我已经在本地安装了 linuxdoc,正如我所提到的,本地构建的 html 文件很有效,并且平面表应该会出现。但是 readthedocs 的构建失败了。
我怀疑我可能需要在 conf.py 中设置 linuxdoc 的路径,但我不知道路径是什么。
我这样安装了linuxdoc:
pip install git+http://github.com/return42/linuxdoc.git
我找不到它的安装位置。任何指导将不胜感激。
解决方案
像这样的依赖项必须显式添加到您的requirements.txt
文件中,
https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html#using-a-configuration-file
# File: docs/requirements.txt
# Defining the exact version will make sure things don't break
sphinx==3.4.3
sphinx_rtd_theme==0.5.1
readthedocs-sphinx-search==0.1.0
linuxdoc==20210324
推荐阅读
- android - FCM 令牌检索在除我之外的其他设备上失败
- python - Python Monty 大厅 n 门数
- opengl - 旋转矩阵未正确应用于向量
- javascript - 如何在下面的代码中打印正确的名称?
- ios - 后台获取在物理设备上不起作用
- kubernetes - 如何在 GKE 中使用临时 IP 创建 Kubernetes 负载均衡器?
- math - 函数的序列表示是否都实际用于计算机科学中的图形?
- c - 我正在尝试在 c 中打印一个点网格
- typescript - TypeScript 3 现在使用 btoa() 产生错误
- scala - 返回 scala 中包含谓词的数字列表