我无法获得任何 python 包来播放音频。我的脚本运行音频文件的完整长度,但实际上并没有将音频渲染到声卡/扬声器。
我已经绑定了 playsound 演示:
from playsound import playsound
playsound('C:\\Users\\My User\\Desktop\\py\\4.wav')
文件停止播放后,我收到以下错误消息:
Error 305 for command:
close "C:\Users\My User~1\AppData\Local\Temp\PS6x1w7c04.wav"
Cannot specify extra characters after a string enclosed in quotation marks.
Failed to close the file: "C:\Users\My User~1\AppData\Local\Temp\PS6x1w7c04.wav"
Traceback (most recent call last):
File "psound.py", line 3, in <module>
playsound('C:\\Users\\My User\\Desktop\\py\\4.wav')
File "C:\Users\My User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\playsound.py", line 46, in _playsoundWin
remove(tempPath)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\My User~1\\AppData\\Local\\Temp\\PS6x1w7c04.wav'
我已经尝试过针对此错误发布的解决方案,但没有任何结果。
我也尝试过 simpleaudio 和 pydub 演示,它们都运行音频文件的持续时间,但不呈现音频,并且两者都没有给出错误消息。
操作系统:Windows 10 Python 版本:3.7.4
我该如何解决?