12

我是 Python 和 cx_Freeze 的新手。请帮我让它工作。

并运行命令:

python setup.py 构建

它给了我以下错误。

缺少的模块:

? 从 serial.serialcli 导入的系统

? 从 serial.serialposix 导入的 TERMIOS

? 从 serial.serialcli 导入的 clr

? 从 wxversion 导入的 wx

我正在使用以下 setup.py 文件。

# Let's start with some default (for me) imports...

from cx_Freeze import setup, Executable

# Process the includes, excludes and packages first

includes = []
excludes = ['_gtkagg', '_tkagg', 'bsddb', 'curses', 'email', 'pywin.debugger',
        'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl',
        'Tkconstants', 'Tkinter']
packages = []
path = []

GUI2Exe_Target_1 = Executable(
    # what to build
    script = "..\esp\main.py",
    initScript = None,
    base = 'Win32GUI',
    targetDir = r"dist",
    targetName = "acup_new.exe",
    compress = True,
    copyDependentFiles = True,
    appendScriptToExe = False,
    appendScriptToLibrary = False,
    icon = None
    )

setup(

    version = "0.1",
    description = "No Description",
    author = "No Author",
    name = "cx_Freeze Sample File",

    options = {"build_exe": {"includes": includes,
                 "excludes": excludes,
                 "packages": packages,
                 "path": path
                 }
           },

    executables = [GUI2Exe_Target_1]
    )
4

1 回答 1

1

基于这个问题,您似乎需要将这些模块添加到includes[]setup.py 文件中的列表中。

我不记得在使用 cx_Freeze 时必须这样做,但是一旦我能找到更多信息,我会编辑这个答案。

于 2012-01-23T02:46:00.780 回答