我的 python 编辑器 Pycharm 和 VS Code 有问题。 我想用 speech_recognition 包运行一些代码,但输出什么也没有。我在两个编辑器中都尝试过,结果是一样的。当我运行这段代码时:
import speech_recognition as sr
listener = sr.Recognizer()
try:
with sr.Microphone() as source:
print('Listening...')
voice = listener.listen(source)
command = listener.recognize_google(voice)
print(command)
except:
pass
输出是:
"C:\Users\Milad Payandeh\PycharmProjects\romantic alexa\venv\Scripts\python.exe" "C:\Users\Milad Payandeh\PycharmProjects\romantic alexa\main.py"
Process finished with exit code 0