我使用的是sphinxapidoc,虽然生成了.rst文件,但当我运行“makehtml”时,似乎无法解析这些模块。错误如下:
WARNING: autodoc: failed to import module u'mathext' from module u'MyRootFolder'; the following exception was raised:
No module named MyRootFolder
我知道问题是什么,但不知道如何解决;MyRootFolder实际上只是添加到搜索路径,并在Python“import mathext”中导入“mathext”模块。在
我怀疑apidoc使用根路径“MyRootFolder”并执行“import”我的根文件夹.mathext'. 在
在我的顶端配置文件文件是以下声明:
^{pr2}$文件夹结构如下所示
MyRootFolder
docs
conf.py
...
mathext.py
another_package
__init__.py
third_module.py
以下是我正在运行的命令(从docs文件夹):
sphinx-apidoc /o ./_modules ../
make html
docs/U模块的结果/我的根文件夹.mathext在
MyRootFolder namespace
======================
Submodules
----------
MyRootFolder.mathext module
------------------------
.. automodule:: MyRootFolder.mathext
:members:
:undoc-members:
:show-inheritance:
编辑: 发现如果我为MyRootFolder下的每个模块/包显式运行sphinx apidoc:
sphinx-apidoc -o ./_modules ../another_package
然后运行“make help”我再也不会遇到这个错误了。但是只能对每个程序包执行此操作(仅接受文件夹作为源),并且我无法获取“数学文本.py““
目前没有回答
相关问题 更多 >
编程相关推荐