为什么会出现WinError?

时间:2019-12-01 10:06:12

标签: python anaconda speech-recognition

我使用anaconda和SpeechRecognition。但是我在Recognize_google上收到错误消息。我该如何解决? 我的代码和下面收到的错误:

import speech_recognition as sr

r=sr.Recognizer()

audio_file = sr.AudioFile('harvard.wav')
with audio_file as source:
    r.adjust_for_ambient_noise(source)
    audio = r.record(source)



r.recognize_google(audio)
r.recognize_google(audio)

Traceback (most recent call last):

  File "<ipython-input-16-59c33ef07a2e>", line 1, in <module>
    r.recognize_google(audio)

  File "C:\Users\asus\Anaconda3\lib\site-packages\speech_recognition\__init__.py", line 828, in recognize_google

  File "C:\Users\asus\Anaconda3\lib\site-packages\speech_recognition\__init__.py", line 457, in get_flac_data

  File "C:\Users\asus\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 143, in __init__
    super(SubprocessPopen, self).__init__(*args, **kwargs)

  File "C:\Users\asus\Anaconda3\lib\subprocess.py", line 775, in __init__
    restore_signals, start_new_session)

  File "C:\Users\asus\Anaconda3\lib\subprocess.py", line 1178, in _execute_child
    startupinfo)

FileNotFoundError: [WinError 2] System cannot find the file specified

0 个答案:

没有答案