Roh*_*tta 13 python python-playsound
请帮忙解决这个错误:
>>> from playsound import playsound
>>> playsound('C:\\Users\\Rohit\\Desktop\\Python\\file.mp3')
Run Code Online (Sandbox Code Playgroud)
终端结果:
PS C:\Users\Rohit\Desktop\Python> & C:/Users/Rohit/AppData/Local/Programs/Python/Python38/python.exe c:/Users/Rohit/Desktop/Python/2Python.py
Error 261 for command:
open "C:\Users\Rohit\Desktop\Python\file.mp3"
The driver cannot recognize the specified command.
Error 261 for command:
close "C:\Users\Rohit\Desktop\Python\file.mp3"
The driver cannot recognize the specified command.
Failed to close the file:
"C:\Users\Rohit\Desktop\Python\file.mp3"
Traceback (most recent call last):
File "c:/Users/Rohit/Desktop/Python/2Python.py", line 3, in <module>
playsound('C:\\Users\\Rohit\\Desktop\\Python\\file.mp3')
File "C:\Users\Rohit\AppData\Local\Programs\Python\Python38\lib\site-packages\playsound.py", line 72, in _playsoundWin
winCommand(u'open {}'.format(sound))
File "C:\Users\Rohit\AppData\Local\Programs\Python\Python38\lib\site-packages\playsound.py", line 64, in winCommand
raise PlaysoundException(exceptionMessage)
playsound.PlaysoundException:
Error 261 for command:
open "C:\Users\Rohit\Desktop\Python\file.mp3"
The driver cannot recognize the specified command.
Run Code Online (Sandbox Code Playgroud)
小智 25
我使用的是 Playsound 版本 = 1.3.0 | 在这个版本中我发现了和你一样的错误。要解决此问题,您必须降级您的播放声音版本。为此,您必须首先通过此代码卸载您的playsound模块...pip uninstall playsound然后按“y”继续。然后通过这个命令安装旧的和纯净的playsound版本...pip install playsound==1.2.2然后尝试执行你的代码。它会起作用。
小智 15
使用
pip install playsound==1.2.2
Run Code Online (Sandbox Code Playgroud)
效果很好。
>>> from playsound import playsound
>>> playsound('C:\\Users\hvars\Downloads\\tiktok.mp3')
Run Code Online (Sandbox Code Playgroud)
注意:- 请避免使用 ''' Playsound==1.3.0 '''
它将生成这样的错误 ''' 驱动程序无法识别指定的命令参数。'''
| 归档时间: |
|
| 查看次数: |
19482 次 |
| 最近记录: |