我是狮身人面像的新手 . 我从一开始就得到了一些东西 .

我的文件结构非常简单:

conf.py

index.rst

p1.rst

P1(资料)

m1.py(p1中的文件)

m2.py(p1中的文件)......

在p1.rst写道:

.. automodule:: p1.m1
    :members:

我在conf.py中添加了抽象路径

sys.path.append(os.path.abspath('.'))

我试图记录时出现问题:

import_object import中的> ... / autodoc.py“,第321行(self.modname)ImportError:没有名为p1.m1的模块D:\ sph_cheng \ p1.rst:4:警告:autodoc无法导入/查找模块'p1.m1',它报告错误:“没有名为p1.m1的模块”,请检查你的拼写和sys.path


当我在conf.py中添加以下内容时

sys.path.append(os.path.abspath('p1'))

并在p1.rst中更改

.. automodule:: m1
    :members:

有用 . 但我想知道应该有一种方法,我不需要在conf.py中添加所有的pathes

sphinx-apidoc为docs提供automodule语句以显示层次结构 . 我不知道为什么带点的自动模块对我不起作用 .

有什么想法吗?谢谢 .

BTW,使用Sphinx 1.1.3和win7