PlaySound 一直给我错误并且不播放声音

PlaySound keeps giving me errors and not playing sound

我正在制作一个需要声音的应用程序,当我尝试播放声音时,我不断收到此错误:

Error 263 for command: open audio1750892060.mp3 The specified device is not open or is not recognized by MCI.

这些是导致错误的代码行:

def speak(audio_string):
    tts = gTTS(text=audio_string, lang='en')
    r = random.randint(1, 5000000000)
    audio_file = 'audio' + str(r) + '.mp3'
    tts.save(audio_file)
    playsound.playsound(audio_file)
    print(audio_string)
    os.remove(audio_file)

折腾了几分钟,用Pygame模块播放声音,成功了!