在我的python(3.4)文件中,我使用了pyglet.media模块。现在我使用variable
以question的结构构建一个exe。我的cx_Freeze
是:
setup.py
当我运行exe时,我收到此错误:
from cx_Freeze import setup, Executable
setup(
name = "program",
version = "1.0",
description = "test",
executables = [Executable("program.py")])
我在ImportError: No module named 'pyglet.media'
的开头添加了import pyglet
,但仍然无效。
如何在exe文件旁边强制导入pyglet.media模块?
答案 0 :(得分:1)
您应该包含pyglet包作为选项。
build_exe_options = {"packages": ["pyglet"]}
from cx_Freeze import setup, Executable
setup(
name = "program",
version = "1.0",
description = "test",
options = {"build_exe":build_exe_options},
executables = [Executable("program.py")])