[英]Importing pocketsphinx not working python 3.2 (Windows). “ImportError: No module named pocketsphinx”
I'm trying to use pocketsphinx on python 3.2 but I'm very confused. 我试图在python 3.2上使用pocketsphinx,但是我很困惑。 I've placed the builded packages in the site-packages directory, made sure I'm using the right audio file format .According to the documentation python is supported because there are python bindings.
我将构建的软件包放置在site-packages目录中,确保使用正确的音频文件格式。根据文档python的支持,因为存在python绑定。 I've looked around the forum and it seems that an
_init_.py
file is needed which is not included so that may be an issue? 我在论坛上四处张望,似乎需要一个
_init_.py
文件,该文件不包含在内,所以可能是个问题? Any suggestions on how to fix this problem? 关于如何解决此问题的任何建议?
I am currently using pocketsphinx and sphinxbase v 0.8 downloaded link and link. 我目前正在使用Pocketsphinx和sphinxbase v 0.8下载链接和链接。 The files I put into site packages are all files contained in the Debug folder of the pocketsphinx directory.
我放入站点包中的文件是Pocketsphinx目录的Debug文件夹中包含的所有文件。 namely:
即:
I am using the following Python code: 我正在使用以下Python代码:
import pocketsphinx as ps
from pocketsphinx import sphinxbase
hmmd = 'C:\Python32\Lib\site-packages\pocketsphinx\model\hmm\en_US\hub4wsj_sc_8k'
lmd = 'C:\Python32\Lib\site-packages\pocketsphinx\model\lm\en_US\hub4.5000.DMP'
dictd = 'C:\Python32\Lib\site-packages\pocketsphinx\model\lm\en_US\hub4.5000.dic'
fraw1 = file(r'C:\Users\Stefan\Documents\2012\40I6\test1.wav', 'rb')
fraw1.seek(44)
speechRec = ps.Decoder(hmm = hmmd, lm = lmd, dict = dictd) speechRec.decode_raw(fRaw1)
result = speechRec.get_hyp()
print (result[0])
To compile python module do the following: 要编译python模块,请执行以下操作:
Run the command 运行命令
python setup_win32.py install python setup_win32.py安装
Change directory to pocketsphinx/python 将目录更改为Pocketsphinx / python
Run the command 运行命令
python setup_win32.py install python setup_win32.py安装
Run the command to test python 运行命令以测试python
python ps_test.py python ps_test.py
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.