py脚本打包exe

abs8023 / 2025-01-15 / 原文

from cx_Freeze import setup, Executable

# Dependencies are automatically detected, but some might need fine tuning
options = {
    "build_exe": {
        "packages" : ["os"],   # 包含你的程序所需的包
        "excludes": [], # 排除不需要的包
        "silent": True, # This option prevents the console window from opening
        "include_files": ["xxxxx.ico"] # 包含额外的文件,如数据文件、图像等 # 替换为图标文件的实际路径
    }
}
executables = [Executable("getpixel.py",base=None,icon="xxxxxx.ico")]

setup(
    name = "mypython",
    version = "v.xx.xx.xx.x",
    description = "description ",
    options = options,
    executables = executables
)