[英]Python: Sphinx Import Error: No module
I have my source codes in the directory - /usr/share/jupiter_api/jupiter_api/services/v1 我的目录中有我的源代码-/ usr / share / jupiter_api / jupiter_api / services / v1
Sphinx Files - 狮身人面像文件-
jupiter_api.rst file generates auto document. jupiter_api.rst文件生成自动文档。
.. automodule:: accounts
:members:
/usr/share/jupiter-doc/api/conf.py /usr/share/jupiter-doc/api/conf.py
sys.path.append(os.path.abspath('/jupiter_api/jupiter_api/servicesi/v1/'))
when I run make clean and make html, I get the below error message - 当我运行make clean和make html时,出现以下错误消息-
Removing everything under '_build'...
[ /usr/share/jupiter-doc/api ]
root@d1piap2077 > make html
Running Sphinx v1.6.2
making output directory...
/usr/lib/python2.7/site-packages/sphinx/util/requests.py:72: UserWarning:
Some links may return broken results due to being unable to check the Server
Name Indication (SNI) in the returned SSL cert against the hostname in the
url requested. Recommended to install requests-2.4.1+.
'Some links may return broken results due to being unable to '
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 1 source files that are out of date
updating environment: 1 added, 0 changed, 0 removed
reading sources... [100%] jupiter_api
WARNING: /usr/share/jupiter-doc/api/jupiter_api.rst:15: (WARNING/2) autodoc:
failed to import module u'accounts'; the following exception was raised:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 657, in
import_object
__import__(self.modname)
ImportError: No module named accounts
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] jupiter_api
generating indices... genindex
writing additional pages... search
copying static files... done
copying extra files... done
dumping search index in English (code: en) ... done
dumping object inventory... done
build succeeded, 1 warning.
Build finished. The HTML pages are in _build/html.
You probably need 你可能需要
sys.path.insert(0, os.path.abspath('../jupiter_api/jupiter_api/services/v1/'))
You can debug this with a print(sys.path)
in your conf.py. 您可以在conf.py中使用
print(sys.path)
进行调试。
ah wait your conf.py is under jupiter_doc/api/
but index.rst
is one level higher. 啊,等你的conf.py在
jupiter_doc/api/
但是index.rst
高一级。 But you have your Makefile at the level of the conf.py, then you do need one more '../'
. 但是,如果您的Makefile位于conf.py级别,那么您确实需要再添加一个
'../'
。 But I guess the master_doc
in your conf.py is jupiter_api
? 但是我猜你conf.py中的
master_doc
是jupiter_api
吗? why aren't index.rst
and conf.py
at same top level in your doc ? 为什么
index.rst
和conf.py
文档的顶层?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.