pygame.init给出'没有声卡'

Jim*_*yap 3 python pygame

我每次运行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)
>>> 
Run Code Online (Sandbox Code Playgroud)

谢谢!

小智 5

我得到了同样的错误,今天就修复了我的linux-mint14.

首先,我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>
Run Code Online (Sandbox Code Playgroud)

它建议我安装包timidity.

然后,我用sudo apt-get install timidity它来安装它.

之后,我使用时没有声卡错误 pygame.init()