Python 属性错误:';识别器';对象没有属性';听一听';
语音识别不工作这里是我的代码:Python 属性错误:';识别器';对象没有属性';听一听';,python,python-2.7,speech-recognition,uigesturerecognizer,listen,Python,Python 2.7,Speech Recognition,Uigesturerecognizer,Listen,语音识别不工作这里是我的代码: robot_ear = speech_recognition.Recognizer() with speech_recognition.Microphone() as mic: print ("Robot: I'm listening") audio = robot_ear.listen(mic) you = robot_ear.recognize_google(audio) print(you) 但是电脑对我说的话没有反应
robot_ear = speech_recognition.Recognizer()
with speech_recognition.Microphone() as mic:
print ("Robot: I'm listening")
audio = robot_ear.listen(mic)
you = robot_ear.recognize_google(audio)
print(you)
但是电脑对我说的话没有反应:
Robot: I'm Listening
Traceback (most recent call last):
File "E:\Python learn\code\nghe.py", line 7, in <module>
audio = robot_ear.Listen(mic)
AttributeError: 'Recognizer' object has no attribute 'Listen'
机器人:我在听
回溯(最近一次呼叫最后一次):
文件“E:\Python learn\code\nghe.py”,第7行,在
音频=机器人耳朵。听(麦克风)
AttributeError:“识别器”对象没有属性“侦听”
请告诉我如何解决此问题:((请告诉我们“语音识别”的版本),您可以发现,通过运行命令
pip freeze
From error statement,代码是不同的,这是导致错误的原因,因为Listen
是大写字母,并且在您的代码中有Listen
l,这是非常完美的,因此请使用该代码进行适当的错误回溯