我想要一个Python脚本,我可以在我的Windows机器上后台运行,它可以播放声音文件
我有两个不同的脚本,只有当我将代码复制并粘贴到Python解释器中时才起作用。声音将成功播放
如果改为转到cmd
并键入python run.py
,脚本将以相同的标准运行,但不会播放声音
# can only hear sound when this code is run in interpreter
from pygame import mixer
mixer.init()
mixer.music.load("C:\\Sound.mp3")
mixer.music.play()
# can only hear sound when this code is run in interpreter
import winsound
winsound.PlaySound("C:\\Sound.wav", winsound.SND_ASYNC)
如何解决这个问题
目前没有回答
相关问题 更多 >
编程相关推荐