sphinxapidoc找不到所有python文件

2024-04-24 03:09:28 发布

您现在位置:Python中文网/ 问答频道 /正文

我有以下两门课:

class Test1():
    """Test1()"""

    def fn_test1():
        """fn_test1 """
        print "Hello1"

一。在

^{pr2}$

这些类存储在不同的文件夹中,如下所示:

$ tree -A
.
├── docs
│   ├── _build
│   ├── conf.py
│   ├── index.rst
│   ├── make.bat
│   ├── Makefile
│   ├── _static
│   ├── _templates
│   └── Test1.rst
└── src
    └── standard
        ├── test1
        │   └── Test1.py
        └── test2
            └── Test2.py

我试图运行sphinx apidoc,但它只通过以下命令找到Test1.rst:

$ sphinx-apidoc -f -A "Author" -H "Test project" -V "version 1.0" -R "release 2014" -F -d 4 -e -P -o docs /home/u/tmp/sphinx/src/standard/*
Creating file docs/Test1.rst.
Creating file docs/conf.py.
Creating file docs/index.rst.
Creating file docs/Makefile.
Creating file docs/make.bat.

如果我移除*它什么也找不到:

$ sphinx-apidoc -f -A "Author" -H "Test project" -V "version 1.0" -R "release 2014" -F -d 4 -e -P -o docs /home/u/tmp/sphinx/src/standard/
Creating file docs/conf.py. 
Creating file docs/index.rst.
Creating file docs/Makefile.
Creating file docs/make.bat.

怎么可能调用sphinxapidoc找到Test1.py和Test2.py?在


Tags: pycreatingsrcdocsindexmakeconfsphinx
1条回答
网友
1楼 · 发布于 2024-04-24 03:09:28

Python打包依赖于目录树。所以从您所做的来看,标准是一个包含两个“子包”的包,test1test2。每个子包都包含一个模块,Test1Test2。在

您必须在每个包含包的目录中添加一个名为\uuinit_u.py的空文件,然后运行

sphinx-apidoc -f -A "Author" -H "Test project" -V "version 1.0" -R "release 2014" -F -d 4 -e -P -o docs /home/u/tmp/sphinx/src/standard/

没有*标志。在

相关问题 更多 >