0

我尝试使用 py2exe 在 python 中从我的程序中制作一个 exe。我的程序包含多个声音和图像文件。问题是,当我尝试运行 exe 时,它​​给了我一个错误:

C:\Users\Eduard\Desktop\testordner>test.exe
test.exe:7: RuntimeWarning: use mixer: DLL load failed: Das
angegebene Modul wurde nicht gefunden.
(ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.)
Traceback (most recent call last):
File "test.py", line 7, in <module>
mixer.init()
File "pygame\__init__.pyc", line 70, in __getattr__
NotImplementedError: mixer module not available
(ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.)

在我的程序中,我还使用了模块 Tkinter、随机、来自 itertools 的循环和来自 pygame 的混合器。我在设置文件中都提到了它们,但我不知道是否有必要。这里也是安装文件:

from distutils.core import setup
import Tkinter as tk
from itertools import cycle
from pygame import mixer
import random
import py2exe

setup(console=[{"script":"test.py"}],options={"py2exe":{"packages":["pygame"]}})
4

1 回答 1

0

我认为这是因为混音器不是模块,它是 pygame 编辑第 7 行的一部分:

   pygame.mixer.init()

我可能错了,我是 pygame 的初学者。编辑:这经常发生在使用一些 pygame 的东西时,有时它可以通过像这样的导入来解决:

    import pygame.mixer

或者你可以试试 pygame2exe

于 2014-09-23T14:24:52.980 回答