即使在python中成功安装了SpeechRecognition模块和pyaudio之后,它也无法检测到语音

时间:2020-03-20 13:09:33

标签: python-3.x

import speech_recognition as sr  

# get audio from the microphone                                                                       
r = sr.Recognizer()                                                                                   
with sr.Microphone() as source:                                                                       
print("Speak:")                                                                                   
audio = r.listen(source)   

try:
    text = r.recognize_google(audio)
    print("You said " + text)
except sr.UnknownValueError:
    print("Could not understand audio")
except sr.RequestError as e:
    print("Could not request results; {0}".format(e))

此代码未执行且保持停滞状态。请帮帮我!

enter image description here

0 个答案:

没有答案