简体   繁体   English

cx_Freeze无法正确将python程序转换为可执行文件

[英]cx_Freeze not correctly converting python program(s) into executable

I have the following files for a project in pygame: 我在pygame中有一个项目的以下文件:

> extras.py

> main.py

> settings.txt

# main.py imports extras.py

I am trying to convert into an executable using cx_Freeze . 我正在尝试使用cx_Freeze转换为可执行文件。

My setup.py file is as follows 我的setup.py文件如下

from cx_Freeze import setup, Executable

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

setup(
    name = 'Pong',
    author = 'Ethan',
    options={
        "build_exe": {
            "packages":["pygame", "sys", "random"],
            "include_files":["settings.txt"]
            }},
    executables = executables,
    version = "5.1.1"
)

It builds without errors but upon running the exe it launches a window then immediately closes. 它的构建没有错误,但是在运行exe它会启动一个窗口,然后立即关闭。 I have gotten a single python file to build but can't figure out how to do multiple. 我已经建立了一个python文件,但无法弄清楚如何做多个。

采用:

executables = [Executable("main.py"), Executable("extras.py")]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM