Python中的语音识别

Python中的语音识别,python,speech,Python,Speech,我找到了语音模块,我可以让我的电脑说出我写的东西。但问题是当我在这里尝试示例代码时:它给了我一个错误,但无法执行。这是我得到的错误: Traceback (most recent call last): File "<pyshell#1>", line 1, in <module> response = speech.input("Say something, please.") File "build\bdist.win32\egg\speech.py", line 1

我找到了语音模块,我可以让我的电脑说出我写的东西。但问题是当我在这里尝试示例代码时:它给了我一个错误,但无法执行。这是我得到的错误:

Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
response = speech.input("Say something, please.")
File "build\bdist.win32\egg\speech.py", line 162, in input
listener = listenforanything(response)
File "build\bdist.win32\egg\speech.py", line 193, in listenforanything
return _startlistening(None, callback)
File "build\bdist.win32\egg\speech.py", line 222, in _startlistening
context = _recognizer.CreateRecoContext()
File "C:\Python26\lib\site-packages\win32com\gen_py\C866CA3A-32F7-11D2-9602-00C04F8EE628x0x5x4.py", line 2648, in CreateRecoContext
ret = self._oleobj_.InvokeTypes(10, LCID, 1, (9, 0), (),)
com_error: (-2147352567, 'Exception raised.', (0, None, None, None, 0, -2147200905),    None)
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
response=speech.input(“请说点什么”)
文件“build\bdist.win32\egg\speech.py”,第162行,输入
listener=listenforanything(响应)
文件“build\bdist.win32\egg\speech.py”,第193行,在listenforaything中
返回(无,回调)
文件“build\bdist.win32\egg\speech.py”,第222行,在
上下文=\识别器.CreateRecoContext()
文件“C:\Python26\lib\site packages\win32com\gen_py\C866CA3A-32F7-11D2-9602-00C04F8EE628x0x5x4.py”,第2648行,在CreateRecoContext中
ret=self.\uOleObj.\uInvokeTypes(10,LCID,1,(9,0),(),)
com_错误:(-2147352567,‘引发异常’,(0,无,无,无,0,-2147200905),无)
我真的希望有人能帮助我

提前多谢了


Jake

为了使语音模块正常工作,您还必须安装pywin32。

您安装了Microsoft语音工具包吗?是的,我安装了。如果它能说出所写的内容,就应该安装它,不是吗?或者,它甚至可以在没有安装该工具包的情况下完成这项工作吗?回溯的最后一行显示用户实际上已经安装了pywin32。问题很可能在于没有正确安装Microsoft语音工具包。