【发布时间】:2021-05-14 04:54:01
【问题描述】:
我在 python 中制作了一个包含 sys 模块的程序。我想使用 cx_Freeze 将其转换为 exe 文件。所以我在 setup.py 中使用了以下代码:
import sys
from cx_Freeze import setup, Executable
base = None
if sys.platform == "win32":
base = "Win32GUI"
options = {"build_exe": {"includes": "atexit"}}
executables = [Executable("myfilename.py", base=base)]
setup(
name="simple_PyQt5",
version="0.1",
description="Sample cx_Freeze PyQt5 script",
options=options,
executables=executables,
)
当我运行命令时:python3 setup.py build 它在其中构建文件夹 build,其中有一个名为“exe.win-amd64-3.9”的文件夹,在 exe.win-amd64 中有一个名为 lib、myfilename.exe、python3.dll 和 python39.dll 的文件夹...当我运行 myfilename.exe 时,它会打开和关闭,而我有一个 input() 它会询问我。 所以你能帮我看看如何使用我想使用 cx_Freeze 转换为 exe 的文件中的 sys 模块
【问题讨论】:
-
这能回答你的问题吗? cx_Freeze doesn't print to console