我已在pocketsphinx-0.8
成功安装了Ubuntu 12.04
,因为我能够通过pocketsphinx_continuous
识别语音。
如何设置import pocketsphinx
之后python
中的pocketsphinx-0.8
目前我正在ImportError: No module named pocketsphinx
答案 0 :(得分:1)
我敢打赌它区分大小写,比如PocketSphinx或其他东西。
我将使用python interactive shell的help()
func ..
matthew@speedy:~/openstack/nova$ python
Python 2.7.3 (default, Sep 26 2012, 21:51:14)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> help()
Welcome to Python 2.7! This is the online help utility.
If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://docs.python.org/2.7/tutorial/.
Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules. To quit this help utility and
return to the interpreter, just type "quit".
To get a list of available modules, keywords, or topics, type "modules",
"keywords", or "topics". Each module also comes with a one-line summary
of what it does; to list the modules whose summaries contain a given word
such as "spam", type "modules spam".
help> modules phinx
Here is a list of matching modules. Enter any module name to get more help.
matplotlib.sphinxext
matplotlib.sphinxext.ipython_console_highlighting - reST directive for syntax-highlighting ipython interactive sessions.
matplotlib.sphinxext.mathmpl
matplotlib.sphinxext.only_directives
matplotlib.sphinxext.plot_directive - A directive for including a matplotlib plot in a Sphinx document.
所以这对我来说只是一个简单的输入:
matthew@speedy:~/Downloads/pocketsphinx-0.8$ sudo apt-get install python-pocketsphinx
...
>>> import pocketsphinx
>>> dir(pocketsphinx)
['Decoder', 'LatLink', 'LatLinkIterator', 'LatNode', 'LatNodeIterator', 'Lattice', '__builtins__', '__doc__', '__file__', '__name__', '__package__']
很难从源代码安装(我放弃了),但很容易安装ubuntu lib。
此网站看起来可能对从源代码安装它有用:http://www.cs.columbia.edu/~ecooper/CS4706/ps-mac.html
答案 1 :(得分:0)
如果您已正确安装pocketsphinx,则此命令应该有效。
import pocketsphinx
如果您仍然遇到问题,请将其放入try / except块:
try:
import pocketsphinx
except:
pass
import pocketsphinx
要在Ubuntu中安装pocketsphinx,您可以使用以下命令:
sudo apt-get install python-pocketsphinx