![](/img/trans.png)
[英]Downgrade to python 3.6.5 with brew: Error /bin/sh: sphinx-build: command not found make: *** [build] Error 127
[英]Sphinx-build generates error for SWIG generated python file while importing the python module
我正在嘗試生成SWIG在C代碼上生成的某些python接口模塊的文檔。 我在SWIG接口文件(* .i)中使用%feature(docstring)
指令,如后文所述: Sphinx和使用Swiged C ++ api記錄python
SWIG正在按預期在生成的python模塊中生成文檔字符串。
但是,當我嘗試從SWIG生成的python模塊中生成文檔時,它會拋出異常:
/home/imitra/testdoc/doc/test_module.rst:4: WARNING: autodoc: failed to import module u'test_module'; the following exception was raised:
Traceback (most recent call last):
File "/home/imitra/.local/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 658, in import_object
__import__(self.modname)
File "/home/imitra/testdoc/generated/test_module.py", line 3, in <module>
_test_module = swig_import_helper()
File "/home/imitra/testdoc/generated/test_module.py", line 25, in swig_import_helper
return importlib.import_module('_test_module')
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named _tiger
當Sphinx嘗試導入test_module.py並執行SWIG生成的代碼時,就會發生這種情況。
有沒有辦法解決這個問題? 我是SWIG和Sphinx的新手。 請分享您的想法。
當我忘記更新我的requirements.txt -file時,我在ReadTheDocs.io上收到類似的錯誤(在構建Sphinx時)。 然后,RTD不知道要安裝所有依賴項。
我對Sphinx的C ++或SWIG知之甚少,或者它是否適用於您的問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.