Speech_recognition 在 VSCode(python) 中不工作

Speech_recognition not working in VSCode(python)

我正在尝试完成一个 UI 提示用户使用屏幕一侧的 Speech-to-Text 但是当我尝试在 VSCode 中录制音频时麦克风会不拾取噪音。我运行在Idle中代码的时候mic是没有问题的。有谁知道如何解决这个问题?

显然 VSCode 没有请求麦克风权限。对于某些人来说,如果您通过 code 从终端启动代码,它似乎可以工作。我按照这里的建议让它工作:https://github.com/MicrosoftDocs/live-share/issues/3254

open vscode
open command pallete (command shift p)
shell command install code in path ( is an option)
get them to run that
close vscode
then from bash type code
permissions then get asked when you execute requiring microphone ( or it did when i ran a python file needing it)