gpt4 book ai didi

python-sphinx - 狮身人面像错误: Unknown directive type "automodule" or "autoclass"

转载 作者:行者123 更新时间:2023-12-03 06:51:07 28 4
gpt4 key购买 nike

我需要使用 Sphinx 记录我的 Python 项目。但我无法使用 autodoc

当我配置项目时,我选择“扩展 autodoc”选项,但现在如果我使用

.. autoclass:: Class

我收到错误:

ERROR: Unknown directive type "autoclass"

我配置了PYTHONPATH,现在一切正常了。但我已经遇到这个问题了。

我的索引文件是:

.. ATOM documentation master file, created by
sphinx-quickstart on Thu Nov 22 15:24:42 2012.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

Welcome to ATOM's documentation!
================================

Contents:

.. toctree::
:maxdepth: 2

.. automodule:: atom

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

最佳答案

同样的事情也发生在我身上!要修复此问题,请转到conf.py 中显示如下内容的行:

extensions = ['sphinx.ext.todo', 'sphinx.ext.viewcode']

你的可能看起来会有所不同。无论如何,将 'sphinx.ext.autodoc' 添加到列表中。例如

extensions = ['sphinx.ext.todo', 'sphinx.ext.viewcode', 'sphinx.ext.autodoc']

如果是:

extensions = []

然后你将其更改为:

extensions = ['sphinx.ext.autodoc']

来源:Sphinx documentation: ERROR: Unknown directive type "program-output"

关于python-sphinx - 狮身人面像错误: Unknown directive type "automodule" or "autoclass",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13516404/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com