第一种方式 :蜂鸣声
import
winsound
# 系统音效
winsound
.
Beep
(
300
,
500
)
# 响铃:300频率,500持续时间
第二种方式 :音乐(wav格式或mp3格式)
-
安装playsound库
pip install playsound
-
运行示例:
from playsound import playsound # 音频播放 playsound ( 'D:/myworkspace/JupyterNotebook/People/music/welcome.wav' ) playsound ( 'D:/myworkspace/JupyterNotebook/People/music/error.wav' )