我是狮身人面像文档的新手,我试图做一天没有成功。我的目录“目录”有两个子目录“项目”(这是我的项目所在的文件夹,其中包含4个python模块(file1.py,file2.py,file3.py,file4.py)和“ docs”,其中使用{{ 1}}我制作了所有必需的文件,然后通过取消注释
来编辑conf.py。sphinx-quickstart
我还编辑了index.rst:
import os
import sys
sys.path.insert(0, os.path.abspath('..')) # two dots are good here for my situation?
并使用命令Welcome to Project's documentation!
=====================================
.. toctree::
:maxdepth: 2
:caption: Contents:
modules
,我创建了project.rst和modules.rst。
当我在docs目录中并且试图“制作html”时,出现以下错误:
sphinx-apidoc -o . ../project/
我还有WARNING: autodoc: failed to import module 'file2' from module 'project'; the following exception was raised:
No module named 'file1'
WARNING: autodoc: failed to import module 'file3' from module 'project'; the following exception was raised:
No module named 'file1'
WARNING: autodoc: failed to import module 'file4' from module 'project'; the following exception was raised:
No module named 'file1'
WARNING: autodoc: failed to import module 'file1' from module 'project'; the following exception was raised:
No module named 'file1'
WARNING: autodoc: failed to import module 'project'; the following exception was raised:
No module named 'file1'
文件,看起来:
__init__.py
有人可以帮助我解决我的问题吗?
modules.rst:
from file1 import *
from file2 import *
from file3 import *
from file4 import *
project.rst:
project
=========
.. toctree::
:maxdepth: 4
project