【发布时间】:2019-02-04 07:08:33
【问题描述】:
我使用的是 python 3.6,在 Windows 7 中导入语音模块时遇到错误。
import speech
import sys
import os
import numpy as np
import pyttsx3
counter = 0
while True:
print ("Talk:")
phrase = speech.input()
print("HERE")
print (phrase)
if phrase == "Friday":
speech.say("Yes sir!, at your service!")
if phrase == ("What's the day today"):
os.system(r"D:\python_github_testing\Basic_Ai-master\checkDay.vbs")
我收到以下错误
Talk:Traceback(最近一次通话最后):文件 “D:\python_github_testing\Basic_Ai-master\testingFriday.py”,第 12 行, 在 短语 = speech.input() 文件 "C:\Users\nnkashyap\AppData\Local\Programs\Python\Python36\lib\site-packages\speech.py", 第 165 行,输入 listener = listenforanything(响应)
文件 "C:\Users\nnkashyap\AppData\Local\Programs\Python\Python36\lib\site-packages\speech.py", 第 196 行,在什么都听 return _startlistening(无,回调)
文件 "C:\Users\nnkashyap\AppData\Local\Programs\Python\Python36\lib\site-packages\speech.py", 第 245 行,在 _startlistening 中 语法.DictationSetState(1)
文件 "C:\Users\NNKASH~1\AppData\Local\Temp\gen_py\3.6\C866CA3A-32F7-11D2-9602-00C04F8EE628x0x5x4.py", 第 2485 行,在 DictationSetState 中 return self.oleobj.InvokeTypes(16, LCID, 1, (24, 0), ((3, 1),),State pywintypes.com_error: (-2147352567, '发生异常。', (0,无,无,无,0,-2147023728),无)
我应该如何解决?
【问题讨论】:
-
能否请您重新格式化您的代码,并添加有关您的系统、库版本、您想要实现的目标的更多信息?
-
我想使用 python 的语音模块进行语音到文本识别。我使用的是 Windows 7。但是该模块的版本是 python 2.7,而我使用的是 python 3.6。
标签: python-3.x speech