我不能使用pocketsphinx api 在编译decoder_test.py:
时import pocketsphinx
我已正确安装了pocketsphinx和sphinxbase,如文档中所述
Decoder
完美无缺。
但是,在调用AttributeError: 'module' object has no attribute 'Decoder'
函数时,错误为{{1}}
答案 0 :(得分:2)
要调试导入,可以使用-v:python -v
启动python,然后键入required import。您应该看到以下内容:
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
dlopen("/usr/lib64/python2.7/lib-dynload/readline.so", 2);
import readline # dynamically loaded from /usr/lib64/python2.7/lib-dynload/readline.so
>>> from pocketsphinx.pocketsphinx import *
import pocketsphinx # directory /usr/local/lib64/python2.7/site-packages/pocketsphinx
# /usr/local/lib64/python2.7/site-packages/pocketsphinx/__init__.pyc matches /usr/local/lib64/python2.7/site-packages/pocketsphinx/__init__.py
import pocketsphinx # precompiled from /usr/local/lib64/python2.7/site-packages/pocketsphinx/__init__.pyc
# /usr/local/lib64/python2.7/site-packages/pocketsphinx/pocketsphinx.pyc matches /usr/local/lib64/python2.7/site-packages/pocketsphinx/pocketsphinx.py
import pocketsphinx.pocketsphinx # precompiled from /usr/local/lib64/python2.7/site-packages/pocketsphinx/pocketsphinx.pyc
import imp # builtin
dlopen("/usr/local/lib64/python2.7/site-packages/pocketsphinx/_pocketsphinx.so", 2);
import _pocketsphinx # dynamically loaded from /usr/local/lib64/python2.7/site-packages/pocketsphinx/_pocketsphinx.so
import sphinxbase # directory /usr/local/lib64/python2.7/site-packages/sphinxbase
# /usr/local/lib64/python2.7/site-packages/sphinxbase/__init__.pyc matches /usr/local/lib64/python2.7/site-packages/sphinxbase/__init__.py
import sphinxbase # precompiled from /usr/local/lib64/python2.7/site-packages/sphinxbase/__init__.pyc
# /usr/local/lib64/python2.7/site-packages/sphinxbase/sphinxbase.pyc matches /usr/local/lib64/python2.7/site-packages/sphinxbase/sphinxbase.py
import sphinxbase.sphinxbase # precompiled from /usr/local/lib64/python2.7/site-packages/sphinxbase/sphinxbase.pyc
dlopen("/usr/local/lib64/python2.7/site-packages/sphinxbase/_sphinxbase.so", 2);
import _sphinxbase # dynamically loaded from /usr/local/lib64/python2.7/site-packages/sphinxbase/_sphinxbase.so
有关详情,请参阅Trace Python imports
如果你看到不同的东西,你有旧版本的pocketsphinx,你没有配置python加载路径,或者你没有正确安装pocketsphinx。