Traceback (most recent call last):
File "D:/桌面备份/脚本/唤醒测试.py", line 15, in <module>
play(song1)
File "C:\Users\langxu\AppData\Roaming\Python\Python38\site-packages\pydub\playback.py", line 71, in play
_play_with_ffplay(audio_segment)
File "C:\Users\langxu\AppData\Roaming\Python\Python38\site-packages\pydub\playback.py", line 15, in _play_with_ffplay
seg.export(f.name, "wav")
File "C:\Users\langxu\AppData\Roaming\Python\Python38\site-packages\pydub\audio_segment.py", line 867, in export
out_f, _ = _fd_or_path_or_tempfile(out_f, 'wb+')
File "C:\Users\langxu\AppData\Roaming\Python\Python38\site-packages\pydub\utils.py", line 60, in _fd_or_path_or_tempfile
fd = open(fd, mode=mode)
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\langxu\\AppData\\Local\\Temp\\tmpjbuaiz4w.wav'
运行时报上方错误,代码中没有显示错误,是由于没有安装pyaudio库,安装相应的库就可以了。
pip install pyaudio
安装成功后,加载环境重新运行就解决问题了。