【发布时间】:2022-03-24 11:20:00
【问题描述】:
问题
单击 readthedocs.io Web 界面上的“构建”时,我无法成功构建文档,但它在我的本地计算机上构建得很好。为了测试这是一个环境问题,我创建了一个虚拟环境:
conda create virtualenv -n venv
conda env export -n venv
source activate venv
然后我将 requirements.txt 文件安装为:
pip install -r requirements.txt
然后跑了
make clean html
在虚拟环境和在线 buildthedocs 中,我收到错误:
Notebook error:
PandocMissing in ex_degassing.ipynb:
Pandoc wasn't found.
Please check that pandoc is installed:
http://pandoc.org/installing.html
make: *** [html] Error 2
我已经搜索并搜索了一个解决方案,但我最好的猜测是 pandoc 不是通过 pip 安装的,即使它在 requirements.txt 文件中。我还尝试通过在我的 requirements.txt 文件中将 pandoc 替换为 git+git://github.com/jgm/pandoc#egg=pandoc 来告诉它从源代码构建,但这不起作用(请参阅下文了解我的文件的外观)。我可以在本地机器上轻松安装 pandoc,但无法通过我的虚拟环境中的 requirements.txt 文件或 readthedocs 安装。
我的一些文件
这是我的 requirements.txt 文件:
sphinx>=1.4
sphinx_rtd_theme
ipykernel
nbsphinx
pandas
pandoc
numpy
matplotlib
ipynb
scipy
我通读了所有 readthedocs documentation,具有讽刺意味的是,我发现构建文档对于我有限的编码能力的人来说严重不足。我尝试制作 readthedocs.yml 和 environment.yaml 文件,但我不知道它们是否在做任何事情或者是否正确编写。为了完整起见,以下是这些文件:
readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py
python:
version: 3.7
install:
- requirements: docs/requirements.txt
environment.yaml
channels:
- conda-forge
dependencies:
- python =3.7
- pandoc
总结
我已经使用 readthedocs 和 sphinx 创建了精美的文档,但我无法将它构建在网络上。我该如何:a)解决安装 pandoc 的问题(这是问题吗??)或 b)消除对 pandoc 的需要(例如,有没有办法在我的文档中包含 jupyter notebook 文件而不需要 pandoc?如何这样做?)?
非常感谢任何人的建议!
【问题讨论】:
-
在新的 Windows 安装中遇到了同样的问题 - 我正在使用 virtualenvwrapper
标签: python pandoc read-the-docs requirements.txt