命令提示符随cx_freeze消失

时间:2013-10-20 01:31:47

标签: python exe cx-freeze

我是使用cx_freeze编译Python文件的新手。我试图将我的程序编译成一个exe,我需要两个txt文件。我使用它作为我的setup.py代码:

from cx_Freeze import setup, Executable

includesfiles = ['textone.txt', 'texttwo.txt']
includes = []
excludes = []
packages = []

setup(
    name = "Program",
    version = "0.1",
    description = "A fun game.",
    author = "author",
    options = {'build_exe': {'excludes':excludes,'packages':packages,'include_files':includesfiles}},
executables = [Executable('program.py')]
)

当我从cmd运行setup.py buld,然后运行它给我的程序时,命令提示符窗口会暂时打开然后关闭,然后才能读取它上面的任何文本。我做错了什么?

1 个答案:

答案 0 :(得分:0)

该代码看起来应该有效。您尝试转换为exe的代码是什么?