我在python程序中尝试使用语音识别从麦克风获取输入
我尝试运行以下代码:-
import speech_recognition as sr
import pyaudio
r = sr.Recognizer()
with sr.Microphone as source:
audio = r.listen(source)
text = r.recognize_google(audio)
print(text)
但它不运行。你知道吗
上面写着:
"C:\Users\Bravo Six\AppData\Local\Programs\Python\Python37-32\python.exe" "D:/BROTEEN/Works/Python/VALINI/speech testing.py"
Traceback (most recent call last):
File "D:/BROTEEN/Works/Python/VALINI/speech testing.py", line 9, in <module>
with sr.Microphone as source:
AttributeError: __enter__
进程已完成,退出代码为1
我怎样才能解决这个问题???请帮我摆脱这种状况!!!你知道吗
I Ctrl + clicked on the sr.**Microphone**, wherein I saw that it said it throws an attribute error when pyaudio 0.2.11 or later is not installed. So I installed it using cmd, but the problem still sustains... HELP!!!
目前没有回答
相关问题 更多 >
编程相关推荐