Sphinx: autodoc can`t import module

删除回忆录丶 提交于 2020-03-23 14:09:09

问题


I have following problem with sphinx. My project structure is

|--project
   |--api
     |--__init__.py
     |--rpc.py
     |--v1
        |--__init__.py
        |--model.py
|--build
|--source
  |--conf.py
|--Makefile

In conf.py I Have

import os
import sys
sys.path.insert(0, os.path.abspath('..'))

If I run

pipenv run sphinx-build ./source ./build

I got following errors:

WARNING: autodoc: failed to import module 'api.rpc'; the following exception was raised:
No module named 'api'
WARNING: autodoc: failed to import module 'api'; the following exception was raised:
No module named 'api'
WARNING: autodoc: failed to import module 'api.v1.model'; the following exception was raised:
No module named 'api'
WARNING: autodoc: failed to import module 'api.v1'; the following exception was raised:
No module named 'api'

Where can be problem? Thank's

来源:https://stackoverflow.com/questions/49004256/sphinx-autodoc-cant-import-module

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!