Python Sphinx中的几个导入错误“No module named”

2024-06-01 21:28:13 发布

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

我是斯芬克斯文档的新手。我按照sphinx documentation为cherrypy项目配置sphinx。但是当我运行make html时,它会给我带来很多错误和警告,如下所示:

Traceback (most recent call last):.root                                                                                                                                                         
File "workspace/myproject-virtualenv/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 321, in import_object
__import__(self.modname)
ImportError: No module named myproject.apps.root.urls
Traceback (most recent call last):
File "workspace/myproject-virtualenv/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 321, in import_object
__import__(self.modname)
ImportError: No module named myproject.apps.root.views
Traceback (most recent call last):.search                                                                                                                                                       
 File "workspace/myproject-virtualenv/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 321, in       import_object                                                                  
__import__(self.modname)                                                                                                                                                                    
ImportError: No module named myproject.apps.search.searchBll                                                                                                                                          
Traceback (most recent call last):                                                                                                                                                              
File "workspace/myproject-virtualenv/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 321, in import_object                                                                  
__import__(self.modname)                                                                                                                                                                    
ImportError: No module named myproject.apps.search.searchDal                                                                                                                                          
Traceback (most recent call last):
File "workspace/myproject-virtualenv/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 321, in import_object
__import__(self.modname)
ImportError: No module named myproject.apps.search.urls
Traceback (most recent call last):
File "workspace/myproject-virtualenv/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 321, in import_object
__import__(self.modname)
ImportError: No module named myproject.apps.search.views
.
.
.
workspace/myproject/docs/api_doc/source/myproject.apps.root.rst:7: WARNING: autodoc can't   import/find module 'myproject.apps.root.urls', it reported error: "No module named myproject.apps.root.urls", please check your spelling and sys.path
workspace/myproject/docs/api_doc/source/myproject.apps.root.rst:15: WARNING: autodoc can't import/find module 'myproject.apps.root.views', it reported error: "No module named myproject.apps.root.views", please check your spelling and sys.path
workspace/myproject/docs/api_doc/source/myproject.apps.search.rst:7: WARNING: autodoc can't import/find module 'myproject.apps.search.searchBll', it reported error: "No module named myproject.apps.search.searchBll", please check your spelling and sys.path
workspace/myproject/docs/api_doc/source/myproject.apps.search.rst:15: WARNING: autodoc can't import/find module 'myproject.apps.search.searchDal', it reported error: "No module named myproject.apps.search.searchDal", please check your spelling and sys.path
workspace/myproject/docs/api_doc/source/myproject.apps.search.rst:23: WARNING: autodoc can't import/find module 'myproject.apps.search.urls', it reported error: "No module named myproject.apps.search.urls", please check your spelling and sys.path
workspace/myproject/docs/api_doc/source/myproject.apps.search.rst:31: WARNING: autodoc can't import/find module 'myproject.apps.search.views', it reported error: "No module named myproject.apps.search.views", please check your spelling and sys.path

looking for now-outdated files... none found
pickling environment... done
checking consistency... workspace/myproject/docs/api_doc/source/modules.rst::       WARNING: document isn't included in any toctree
done
preparing documents... done
writing output... [100%]   modules                                                                                                                                                                
writing additional files... (0 module code pages) genindex search
copying static files... done
dumping search index... done
dumping object inventory... done
build succeeded, 21 warnings.

Build finished. The HTML pages are in build/html.

有希望吗?有人请帮忙。。我还将conf.py中的行更改如下:

sys.path.append('workspace/myproject/src/myproject/')

Tags: appsnoinpyimportdocssearchobject