Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 属性错误:';识别器';对象没有属性';听一听';_Python_Python 2.7_Speech Recognition_Uigesturerecognizer_Listen - Fatal编程技术网

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,这是非常完美的,因此请使用该代码进行适当的错误回溯