要调试导入,您可以使用 -v: 启动 python python -v
,然后键入所需的导入。您应该看到以下内容:
[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
有关更多详细信息,请参阅跟踪 Python 导入
如果你看到不同的东西,你有较旧的 pocketsphinx 安装,你没有配置 python 加载路径或者你没有正确安装 pocketsphinx。