0

所以基本上这是我的代码:

from playsound import playsound

playsound('C:\\Users\\arnavb\\Desktop\\Python\\Lecture1\\song.mp3')

我得到的错误是:

PS C:\Users\arnavb\Desktop\Python> & C:/Users/arnavb/AppData/Local/Programs/Python/Python39/python.exe c:/Users/arnavb/Desktop/Python/Lecture1/Practice_3.py

    Error 305 for command:
        open "C:\Users\arnavb\Desktop\Python\Lecture1\song.mp3"
    Cannot specify extra characters after a string enclosed in quotation marks.

    Error 263 for command:
        close "C:\Users\arnavb\Desktop\Python\Lecture1\song.mp3"
    The specified device is not open or is not recognized by MCI.
Failed to close the file: "C:\Users\arnavb\Desktop\Python\Lecture1\song.mp3"
Traceback (most recent call last):
  File "c:\Users\arnavb\Desktop\Python\Lecture1\Practice_3.py", line 2, in <module>
    playsound('C:\\Users\\arnavb\\Desktop\\Python\\Lecture1\\song.mp3')
  File "C:\Users\arnavb\AppData\Local\Programs\Python\Python39\lib\site-packages\playsound.py", line 72, in _playsoundWin
    winCommand(u'open {}'.format(sound))
  File "C:\Users\arnavb\AppData\Local\Programs\Python\Python39\lib\site-packages\playsound.py", line 64, in winCommand
    raise PlaysoundException(exceptionMessage)
playsound.PlaysoundException:
    Error 305 for command:
        open "C:\Users\arnavb\Desktop\Python\Lecture1\song.mp3"
    Cannot specify extra characters after a string enclosed in quotation marks.
4

1 回答 1

3

请按照以下步骤操作:

pip uninstall playsound
pip install playsound==1.2.2
于 2021-10-24T11:49:14.687 回答