我试图在在线教程的帮助下编写语音助手。当我尝试运行代码时,我不断收到一条错误消息:
Error 263 for command:
close voice.mp3
The specified device is not open or is not recognized by MCI.
Failed to close the file: voice.mp3
*注意:“voice.mp3”是我给 mp3 文件起的名字。
这是程序中唯一使用“voice.mp3”以及 Playsound 模块的函数:
def speak(text):
tts = gTTS(text=text, tld="ca", lang="en")
filename = "voice.mp3"
tts.save(filename)
playsound.playsound(filename)
我相信这与Playsound有关。有谁知道如何解决这一问题?