gpt4 book ai didi

python - Cx_Freeze - 如何包含模块

转载 作者:太空宇宙 更新时间:2023-11-04 01:35:18 25 4
gpt4 key购买 nike

我在将内容包含到我的 cx_Freeze 脚本中时遇到了这个问题,我试图做的是包含 easygui 和 sys,因为我在我的程序中使用它们。任何帮助将不胜感激!

代码如下:

import sys
from cx_Freeze import setup, Executable


build_exe_options = {"packages": ["os"], "excludes": ["tkinter"] }


base = None
if sys.platform == "win32":
base = "Win32GUI"

setup( name = "ProgramGUI",
version = "0.1",
description = "My GUI application!",
options = {"build_exe": build_exe_options},
executables = [Executable("ProgramGUI.py", base=base)])

所以我真正需要知道的是如何将 Includes[ "sys", "easyGUI"] 合并到安装脚本中 :D

最佳答案

说真的,我认为你只是错过了一件小事来告诉 cx_freeze 导入 easy_gui:

import sys
from cx_Freeze import setup, Executable


build_exe_options = {
"packages": ["os", "sys"],
"excludes": ["tkinter"],
"includes": ["easy_gui"] # <-- Include easy_gui
}

base = None
if sys.platform == "win32":
base = "Win32GUI"

setup( name = "ProgramGUI",
version = "0.1",
description = "My GUI application!",
options = {"build_exe": build_exe_options},
executables = [Executable("ProgramGUI.py", base=base)])

关于python - Cx_Freeze - 如何包含模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10512160/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com