无法在 VSCode 中使用 Python speech_recognition 读取麦克风

问题描述 投票:0回答:0

This is screenshot 我试图创建一个语音助手, 这是我从代码中得到的错误。

这是代码。
import speech_recognition as sr
import pyaudio
import time

lesen = sr.Recognizer()
isL = True
inti = 0

try:
    with sr.Microphone as source:
        print("........................")
        voice = lesen.listen(source)
        command = lesen.recognize_google(voice)
        print(command)
except:
    print('Error')
    pass

请给我一个解决方案!

我试着做一个语音助手,我在尝试读取麦克风时出错,然后我出错了,VSCode 无法读取麦克风。

python visual-studio microphone
© www.soinside.com 2019 - 2024. All rights reserved.