Python speechrecognition“子进程错误”

2024-05-16 08:32:48 发布

您现在位置:Python中文网/ 问答频道 /正文

因此,我正在试用python中的speechrecognition模块(https://pypi.python.org/pypi/SpeechRecognition/),并尝试以下代码:

import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as source:                # use the default microphone as the audio source
    audio = r.listen(source)                   # listen for the first phrase and extract it into audio data

try:
    print("You said " + r.recognize(audio))    # recognize speech using Google Speech Recognition
except LookupError:                            # speech is unintelligible
    print("Could not understand audio")

运行时,我得到以下错误:

^{pr2}$

额外信息:在运行代码后的几秒钟内,代码崩溃并产生错误。在

有人知道是什么导致了这个错误,我该怎么解决它?在

谢谢, 汤姆


Tags: 模块the代码httpspypisourceas错误