Skip to main content
 首页 » 编程设计

python之Sphinx 卡在阅读资源索引上

2025年04月02日15傻小

当我输入 make html 时,Sphinx 卡在阅读部分。

通过更改“asp”中的名称可以更改它卡住的百分比。我的范围是 100% 到 25%。 这是我在运行 make html 时在终端中看到的示例:

make html 
sphinx-build -b html -d _build/doctrees   . _build/html 
sphinx-build -b html -d _build/doctrees   . _build/html 
Running Sphinx v1.2.1 
loading pickled environment... done 
building [html]: targets for 2 source files that are out of date 
updating environment: 0 added, 2 changed, 0 removed 
reading sources... [ 50%] asp                                                                                                   

如前所述,50% 不是恒定的。通过更改 asp.rst 文件的名称,它会更改我获得的百分比。但它从未超越它。

这是我的 asp.rst 文件:

 .. _asp: 
 
 TEST123 
 ======= 
 
 
.. automodule:: rcegui 
.. module:: RCEController 
.. autoclass:: RCE_Control_MainWindow 
    :members: 

这是我的 index.rst 文件:

Welcome to GUI's documentation! 
=============================== 
 
Contents: 
 
.. toctree:: 
   :maxdepth: 2 
 
   asp 
 
Indices and tables 
================== 
 
* :ref:`genindex` 
* :ref:`modindex` 
* :ref:`search` 

这是conf.py:

import sys 
import os 
# If extensions (or modules to document with autodoc) are in another directory, 
# add these directories to sys.path here. If the directory is relative to the 
# documentation root, use os.path.abspath to make it absolute, like shown here. 
#sys.path.insert(0, os.path.abspath('.')) 
sys.path.append(os.path.abspath('../')) 
 
# -- General configuration ------------------------------------------------ 
 
# If your documentation needs a minimal Sphinx version, state it here. 
#needs_sphinx = '1.0' 
 
# Add any Sphinx extension module names here, as strings. They can be 
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 
# ones. 
extensions = [ 
'sphinx.ext.autodoc', 
'sphinx.ext.doctest', 
'sphinx.ext.coverage', 
] 

移除覆盖扩展也改变了阅读百分比。但它仍然卡住了。这似乎是由于 RCEController 文件造成的,它生成一个 GUI 并需要用户输入。

请您参考如下方法:

在asp.rst的开头添加一行.. _asp:

.. _asp: 
 
TEST123 
======= 
 
.. automodule:: rcegui 
.. module:: RCEController 
.. autoclass:: RCE_Control_MainWindow 
   :members: 

对于 index.rst

Welcome to GUI's documentation! 
=============================== 
 
Contents: 
 
.. toctree:: 
   :maxdepth: 2 
 
   asp 
 
Indices and tables 
================== 
 
* :ref:`genindex` 
* :ref:`modindex` 
* :ref:`search` 

请遵循正确的缩进和空格的准确代码。

例如,在rst中,标题和下划线的长度应该相同。

TEST123 
=======