我有一个非常庞大的 python 脚本,我正在尝试 cx_freeze,但是当我运行可执行文件时,我不断收到相同的错误,它似乎与 docx 模块有关。
我在 Windows 8.1 机器上使用 Python 3.3.5 和 docx 0.7.6-py33。
这是我的设置脚本。
from cx_Freeze import setup, Executable
includefiles = ['logo.ico','db.db','dbloc.bin']
includes = []
excludes = []
packages = ['tkinter','docx','sys', 'sqlite3', 'os', 'hashlib', 'random', 'uuid', 'base64', 'tempfile', 'win32api',
'winreg', 'ntplib', 'winsound', 'time', 'csv', 'webbrowser', 'inspect','datetime', 'decimal', 'ctypes',
'win32com.client','operator']
exe = Executable(
# what to build
script = "NEPOS.py",
initScript = None,
base = 'Win32GUI',
targetName = "Nepos.exe",
copyDependentFiles = True,
compress = True,
appendScriptToExe = True,
appendScriptToLibrary = True,
icon = 'Icon.ico'
)
setup(
name = "MyProgram",
version = "1.0.0",
description = 'Description',
author = "Joe Bloggs",
author_email = "123@gmail.com",
options = {"build_exe": {"excludes":excludes,"packages":packages,
"include_files":includefiles}},
executables = [exe]
)
这是我得到的错误。
看起来它很难找到属于 docx 的方法,但是我的源代码调用import docx
并且它在安装文件中被列为依赖模块,所以我不确定为什么不包含它们。