0
我被pythons卡住sphinx
。我的目录树是这个样子:当它们位于子目录中时,在sphinx index.rst中包含ipynb文件
| - project_root
| | - importable_project
| | | - importable_module.py
| | | - another_importable_module.py
| | | - Tutorials
| | | | - tutorial1.ipynb
| | - docs
| | | - build
| | | | - sphinx_build_files_and_folders
| | | - source
| | | | - _static
| | | | - _templates
| | | | - conf.py
| | | | - index.rst
| | | | - modules.rst
我已经启用了nbsphinx extention按照指示,我修改源文件夹中的文件index.rst
。
这里是什么index.rst
文件目前的样子:
.. Pycotools documentation master file, created by
sphinx-quickstart on Wed Oct 11 11:46:06 2017.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to Pycotools's documentation!
=====================================
.. toctree::
:maxdepth: 2
:caption: Contents:
/modules
../../importable_project/Tutorials/tutorial1
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
绝大部分原因是自动生成的sphinx-quickstart
。我知道这里指定的文件路径是相对于index.rst
文件的位置。因此,在这种情况下,project_root/docs/source
和sphinx能够为moudles.rst
生成html,上面的文件为index.rst
。
问题是我想将我的教程包含在文档中,但行../../importable_project/Tutorials/tutorial1
无法找到tutorial1.ipynb
。
有人可以建议我做错了什么吗?
教程是文档,应该移到'docs/source'目录。狮身人面像无法在源目录之外找到文件,除了通过autodoc打包。移动'.ipynb'文件后,您需要相应地调整路径。 –
谢谢。这工作。发表一个答案,我会接受。 – CiaranWelsh