pygame.init提示“没有声卡”
每次我运行pygame.init()的时候,都会出现“没有声卡”的提示。有一个人在ubuntu论坛上说可以运行pygame.init()两次,这样这个提示就会消失。不过,当我写了一个脚本,然后从终端运行这个脚本时,还是会出现没有声卡的提示。
我该怎么办呢?
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame, sys
>>> pygame.init()
there is no soundcard
(6, 0)
>>>
谢谢!
3 个回答
0
我放弃了,直接在我的Python脚本里启动了一个叫做aplay的子进程。这样做似乎比使用pygame库要快。
0
我也遇到了同样的错误,不过声音还是能正常使用,可能最好就忽略这个警告吧。
5
我今天在我的Linux Mint 14上遇到了同样的错误,并且解决了它。
首先,我使用 apt-cache depends python-pygame
来查看 python-pygame 依赖的包。
结果是:
依赖: python2.7
依赖: python
依赖: python
依赖: libc6
依赖: libjpeg8
依赖: libpng12-0
依赖: libportmidi0
依赖: libsdl-image1.2
依赖: libsdl-mixer1.2
依赖: libsdl-ttf2.0-0
依赖: libsdl1.2debian
依赖: libsmpeg0
依赖: libx11-6
依赖: python-numpy
依赖: ttf-freefont
fonts-freefont-ttf
建议: timidity
冲突: <python2.3-pygame>
冲突: <python2.4-pygame>
替换: <python2.3-pygame>
替换: <python2.4-pygame>
它建议我安装一个叫 timidity
的包。
然后,我用 sudo apt-get install timidity
来安装它。
安装完成后,当我使用 pygame.init()
时,就没有声音卡的错误了。