使用cx_freeze命令提示符消失 [英] Command prompt disappears with cx_freeze

查看:68
本文介绍了使用cx_freeze命令提示符消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是刚使用cx_freeze编译Python文件的人。我正在尝试将程序编译为exe,并且需要两个txt文件。我使用它作为我的setup.py代码:

I am brand new to using cx_freeze for compiling Python files. I am trying to compile my program into an exe, and I need two txt files to go along with it. I am using this as my setup.py code:

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 时,然后运行程序,命令提示符窗口会短暂打开,然后关闭,然后我才能阅读其中的任何文本。我在做什么错?

When I run setup.py buld from cmd, and then run the program that it gives me, the command prompt window briefly opens then closes before I can read any text on it. What am I doing wrong?

推荐答案

该代码看起来应该可以工作。您要转换为exe的代码是什么?

That code looks like it should work. What is the code you're trying to convert to exe?

这篇关于使用cx_freeze命令提示符消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆