Python 不玩音乐的游戏

Python 不玩音乐的游戏,python,audio,pygame,Python,Audio,Pygame,我有一些在Python3.4中使用PyGame播放声音的简单代码 import pygame file = 'Henesys.ogg' # this file exists in current directory pygame.init() pygame.mixer.init() pygame.mixer.music.load(file) pygame.mixer.music.play(0) pygame.event.wait() 但是,当我运行它时,它不工作。当在空闲状态下运行时,解释器外

我有一些在Python3.4中使用PyGame播放声音的简单代码

import pygame
file = 'Henesys.ogg' # this file exists in current directory
pygame.init()
pygame.mixer.init()
pygame.mixer.music.load(file)
pygame.mixer.music.play(0)
pygame.event.wait()
但是,当我运行它时,它不工作。当在空闲状态下运行时,解释器外壳不再按预期反应,但不会播放声音。我不知道为什么。我在互联网上搜索,发现人们可以毫无问题地运行这段代码。我无法确定问题可能在哪里

有人能告诉我我做错了什么吗

作为参考,我的操作系统是Windows 7 64位,安装了Python 3.4.3,Pygame安装在wheel:Pygame-1.9.2a0-cp34-none-32.whl

同样作为参考,platform.architecture返回“32位”、“WindowsPE”


谢谢。

您可以尝试的第一件事是更改

pygame.mixer.music.play(0)
pygame.mixer.music.load(file)
排队

pygame.mixer.music.play(0, 0.0)
正如我在上发现的,pygame.mixer.music.play有两个参数

您可以尝试的第二件事是更改

pygame.mixer.music.play(0)
pygame.mixer.music.load(file)