警告: autodoc: 导入类失败。找不到模块 'nats'

2024-05-21 04:00:01 发布

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

我在狮身人面像里建文件有问题。我有asyncio nats客户机库,但无法理解它如何依赖于构建sphinx降价文档。你知道吗

我已经为我的asyncio python项目安装了sphinx和recomonmark库。当我键入make markdown时,我得到了错误消息:

WARNING: autodoc: failed to import class 'api_access_rules.API' from module 'lib'; the following exception was raised:
No module named 'nats'

我在Pycharm工作,我的项目结构是:

- project_name
  - docs
  - lib

在lib中,我有我的类,我想做降价文档。 在斯芬克斯文件中

这是我的形态py地址:

import os
import sys

sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../../'))


extensions = [
    'recommonmark',
    'sphinx.ext.autodoc',
    'sphinx.ext.todo',
    'sphinx.ext.coverage',
    'sphinx.ext.extlinks',
]

source_suffix = {
    '.rst': 'restructuredtext',
    '.txt': 'markdown',
    '.md': 'markdown',
}

templates_path = ['_templates']
exclude_patterns = []


html_theme = 'bizstyle'

html_static_path = ['_static']

还有我的索引.rst地址:

Welcome to managing-nats-api's documentation!
=============================================

.. toctree::
   :maxdepth: 2
   :caption: Contents:

.. autoclass:: lib.api_access_rules.API
   :members:

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

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

求求你,救命啊,差不多一个星期了,我试着解决这个问题。尝试make clean没有结果。你知道吗


Tags: 文件path项目文档importrefapiasyncio