【问题标题】:cx_freeze : compiled tkinter app is not lauchingcx_freeze:编译 tkinter 应用程序未启动
【发布时间】:2015-02-08 17:26:43
【问题描述】:

这是我第一次使用 cx_freeze,我真的需要这方面的帮助,我一直在到处寻找,但找不到答案。

我在编译过程中没有任何错误,但可执行文件没有做任何事情。谁能解释一下为什么?

这是我的项目结构:

应用

  • setup.py
  • application.py(从 cell.py 导入 2 个函数的 Tkinter 应用)
  • logo.jpg
  • favicon.ico
  • responsible.xls
  • 模块:
    • cell.py(所有工作都在这个文件中完成)

我不知道在 setup 中包含文件 cell.py 的位置,现在它在文件 Modules 中。而且我不确定 Tkinter 是否应该包含或排除。

这里是 setup.py 文件:

import sys
from cx_Freeze import setup, Executable


executables = [
        Executable("application.py")
]

buildOptions = dict(
        compressed = True,
        includes = ["sys","re","PIL","ttk","xlrd","xlutils","datetime","string","Tkinter"],
        include_files = ["responsible.xls","favicon.ico","logo.jpg"],
        excludes = []
        path = sys.path + ["modules"]
)

setup(
    name = "test",
    version = "1.1.1.0",
    description = "test",
    options = dict(build_exe = buildOptions),
    executables = executables
 )

【问题讨论】:

  • 尝试从命令提示符启动它 - 双击它时可能会出现您看不到的错误。

标签: python tkinter cx-freeze


【解决方案1】:

您可以使用 include_files 选项添加要包含的目录。 所以你的这部分代码应该是这样的:

buildOptions = dict(
        compressed = True,
        includes = ["sys","re","PIL","ttk","xlrd","xlutils","datetime","string","Tkinter"],
        include_files = ["responsible.xls","favicon.ico","logo.jpg", "modules"],
        excludes = []
        path = sys.path + ["modules"]
)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-20
    • 1970-01-01
    • 1970-01-01
    • 2015-10-03
    • 1970-01-01
    相关资源
    最近更新 更多