我在Python中遇到了Sphinx的问题。即使我遵循了https://groups.google.com/forum/#!topic/sphinx-users/lO4CeNJQWjg的指示,我也无法解决它
我有文档/源文件夹,其中包含:
在conf.py中,我用以下方式指定abs路径:
sys.path.insert(0, os.path.abspath('..'))
在index.rst中,我通过以下方式调用RstFiles文件夹中的所有模块:
.. toctree::
:maxdepth: 2
:caption: Contents:
BatchDataContainer.rst
BatchDefaultValues.rst
BatchTypes.rst
最后,每个.rst文件的内容如下所示:
BatchDataContainer
==================
.. automodule:: RstFiles.BatchDataContainer
:members:
当我运行sphinx build时,我得到两个主要错误:
D:\hfTools\Projects\Validation-Source\Docs\source\RstFiles\BatchDataContainer.rst: WARNING: document isn't included in any toctree
及
WARNING: autodoc: failed to import module 'BatchDataContainer' from module 'RstFiles'; the following exception was raised: No module named 'RstFiles'
有什么想法可能是错误的,因为我已经尝试了不同的东西,但没有任何帮助
如果conf.py位于该目录中
D:\hfTools\Projects\Validation Source\Docs\Source
该项目的Python模块(包括BatchDataContainer.py)位于
D:\hfTools\Projects\Validation Source\Products
然后您需要conf.py中的
sys.path.insert(0, os.path.abspath('../..'))
automodule
指令也需要更新:相关问题 更多 >
编程相关推荐