问题描述
我正在我的 Mac 上玩 Pygame,运行 OSX Yosemite.我无法使用以下代码播放 MP3 文件:
I'm playing around with Pygame on my Mac, running OSX Yosemite. I can't get it to play an MP3 file using the following code:
pygame.mixer.music.load('bg_music.mp3')
pygame.error: Unrecognized music format
我使用的是 Python 2.7.1 并安装了以下库:
I'm using Python 2.7.1 and have the following libraries installed:
- sdl(酿造):1.2.15
- sdl_mixer(酿造):1.2.12
- libvorbis (brew): 1.3.4
- pygame:1.9.2a0
我已经搜索并尝试了所有建议在此线程上 没有成功.
I've searched around and tried all the suggestions on this thread without success.
有没有人知道如何让这件事发挥作用?
Does anyone have any ideas how I can get this thing to work?
推荐答案
您是否安装了 SMPEG 库?libvorbis 用于 .ogg 支持,.mp3 需要 SMPEG 或 MAD 库,如 SDL_mixer 手册.
Do you have SMPEG library installed? libvorbis is used for .ogg support, .mp3 requires either SMPEG or MAD libraries, as stated in SDL_mixer manual.
这篇关于OSX Yosemite 上的 pygame:无法识别的音乐格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!