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

问题描述 投票:0回答:1

我在pygame中有一个项目的以下文件:

> extras.py

> main.py

> settings.txt

# main.py imports extras.py

我试图使用cx_Freeze转换为可执行文件。

我的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"
)

它构建没有错误,但在运行exe时它启动一个窗口然后立即关闭。我已经有一个python文件要构建,但无法弄清楚如何做多个。

python cx-freeze
1个回答
1
投票

使用:

executables = [Executable("main.py"), Executable("extras.py")]
© www.soinside.com 2019 - 2024. All rights reserved.