python - Cx_Freeze - 如何包含模块

标签 python include cx-freeze

我在将内容包含到我的 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/

相关文章:

python - 哪个更好 - PyInstaller 或 cx_Freeze?

python - Pygame cx_freeze 语法错误

python - 将 facebook 登录与 python 集成到 google 应用引擎中

python - 如何从 Microsoft Academys API 获取 session 论文

python - 如何从 Python 中的 Flask 应用程序调用某些函数?

c++ - fatal error C1083 : Cannot open include file: 'iostream' : No such file or directory

html - Jekyll:生成一次包含并将其包含到所有页面

python - 不理解 undefined reference

c++ - C++ 中的循环依赖帮助

Python cx_Freeze - 一个可执行文件无法打开另一个?