Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
186 views
in Technique[技术] by (71.8m points)

python - 为什么会出现WinError?(Why do I get WinError?)

I use anaconda and SpeechRecognition.

(我使用anaconda和SpeechRecognition。)

But I get error on recognize_google.

(但是我在Recognize_google上收到错误消息。)

How can I fix it?

(我该如何解决?)

my code and the error I received below:

(我的代码和以下错误:)

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:UsersasusAnaconda3libsite-packagesspeech_recognition\__init__.py", line 828, in recognize_google

  File "C:UsersasusAnaconda3libsite-packagesspeech_recognition\__init__.py", line 457, in get_flac_data

  File "C:UsersasusAnaconda3libsite-packagesspyder_kernelscustomizespydercustomize.py", line 143, in __init__
    super(SubprocessPopen, self).__init__(*args, **kwargs)

  File "C:UsersasusAnaconda3libsubprocess.py", line 775, in __init__
    restore_signals, start_new_session)

  File "C:UsersasusAnaconda3libsubprocess.py", line 1178, in _execute_child
    startupinfo)

FileNotFoundError: [WinError 2] System cannot find the file specified
  ask by rukiye translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...