This File is saved as abc.py
#import pyaudio
#Tried import pyaudio
import speech_recognition as sr
r=sr.Recognizer()
with sr.Microphone() as source:
print("say anything")
audio=r.listen(source)
try:
text=r.recognize_google(audio)
#text=r.google_recognize(audio)
#Tried text=r.google_recognize(audio)
print("you said : {}".format(text))
except:
print("can't recognize what you said")
除了成功编译和执行此代码外,我的实际输出是:- r = sr.Recognizer() AttributeError:模块“ speech_recognition”没有属性“ Recognizer”
我已经在python IDLE 3.7.3(64位)中运行了该程序,如果我在spyder版本3.7.3(64位)中或Visual Studio中运行(如果在Visual Studio中) studio应该是什么版本?