【问题标题】:Mixer module won't initiate混音器模块不会启动
【发布时间】:2021-06-07 20:14:06
【问题描述】:

我一直在尝试进入 pygame,我想播放声音。我尝试像这样启动混音器模块:

import pygame
import time
pygame.init()
pygame.mixer.init()

当我运行它时,它给出了这个错误:

Traceback (moce recent call last):
    File "main.py", line 5 in <module>
        pygame.mixer.init()
pygame.error: ALSA: Couldn't open audio device: No such file or directory

我在 repl.it 上运行代码,但我不确定它是否是 repl 的问题,因为它导致在默认 IDLE 上完美运行的代码出现问题。

【问题讨论】:

    标签: python pygame mixer


    【解决方案1】:

    pygame.mixer 无法在 repl.it 上工作,因为它没有与之关联的音频设备
    正如你所说,它适用于 IDLE。这是因为您的设备有音频设备

    【讨论】:

    • 你为什么认为TC在repl.it中运行代码?
    • @r2d2 抱歉,TC 的完整形式是什么
    猜你喜欢
    • 1970-01-01
    • 2012-07-25
    • 2023-04-10
    • 2018-06-10
    • 1970-01-01
    • 1970-01-01
    • 2022-01-15
    • 2016-10-21
    • 2017-06-13
    相关资源
    最近更新 更多