【问题标题】:Python py2exe dll load fail pygame mixer module not availablePython py2exe dll 加载失败 pygame 混合器模块不可用
【发布时间】:2014-09-20 17:06:42
【问题描述】:

我尝试使用 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"]}})

【问题讨论】:

    标签: python module pygame py2exe mixer


    【解决方案1】:

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

       pygame.mixer.init()
    

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

        import pygame.mixer
    

    或者你可以试试pygame2exe

    【讨论】:

    • 只有将整个程序转成一个.exe后才可以
    • 我在 pygame._view 上遇到了类似的问题,直到编译我用 import pygame._view 解决了它,你可以尝试 import pygame.mixer
    • 好吧,我收到了这个错误C:\Users\Eduard\Desktop\test&gt;test.exe Traceback (most recent call last): File "test.py", line 3, in &lt;module&gt; import pygame.mixer File "pygame\mixer.pyc", line 12, in &lt;module&gt; File "pygame\mixer.pyc", line 10, in __load ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.
    • 那我不知道该说什么了。我不建议重新安装,因为这可能会浪费时间。也许pygame2exe可以帮助你[link]pygame.org/wiki/Pygame2exe
    • 不,我猜不是因为我没有 pygame 程序。 GUI 是用 Tkinter 构建的。我只使用 pygame 来播放声音,仅此而已。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-01
    相关资源
    最近更新 更多