我今天开始学习 python,模块的第一个示例是 playsound 模块,它在我的代码中不起作用。有人能帮助我吗?
代码:
from playsound import playsound
playsound('E:\Python\Chapter 1\music.mp3')
错误:
PS E:\Python\Chapter 1> & C:/Users/EIC/AppData/Local/Programs/Python/Python310/python.exe "e:/Python/Chapter 1/pracSetQ3.py"
Traceback (most recent call last):
File "e:\Python\Chapter 1\pracSetQ3.py", line 2, in <module>
playsound('E:\Python\Chapter 1\music.mp3')
File "C:\Users\EIC\AppData\Local\Programs\Python\Python310\lib\site-packages\playsound.py", line 35, in _playsoundWin
winCommand('open "' + sound + '" alias', alias)
File "C:\Users\EIC\AppData\Local\Programs\Python\Python310\lib\site-packages\playsound.py", line 31, in winCommand
raise PlaysoundException(exceptionMessage)
playsound.PlaysoundException:
Error 277 for command:
open "E:\Python\Chapter 1\music.mp3" alias playsound_0.5643776315006501
A problem occurred in initializing MCI.