我在 Python27 中编写的最后一个程序(在 windows7 64x 中,带有 cx_freeze 3.4.1 的 exe)在几乎所有计算机上都没有问题,但是在一台计算机上(也使用 windows7 64x)我收到以下错误消息:
cx_Freeze 致命错误
无法获取 zipimporter 实例
我尝试使用以下方法修复它:
我从代码中删除了所有非 ASCII(包括评论中的那些)。
我将模块“zlib”添加到设置和程序导入的包含中。
我在设置的构建选项中添加了 "include_msvcr" : True,以便与其他 Windows 版本兼容。
但它仍然不起作用。
这是我的 setup.py :
# -*- coding: utf-8 -*-
# from http://python.jpvweb.com/mesrecettespython/doku.php?id=cx_freeze
import sys, os
from cx_Freeze import setup, Executable
#############################################################################
# preparation des options
#path = sys.path.append(os.path.join("..", "..", "biblio"))
includes = ["re", "pptx", "Tkinter", "tkFileDialog", "tkMessageBox", "lxml", "lxml._elementpath", "lxml.etree",\
"gzip", "encodings.cp949", "encodings.utf_8", "encodings.ascii", "PIL", "zlib"]
excludes = []
packages = ["pptx", "PIL"]
zip_includes = [("C:/Users/Bruno/Dropbox/Moi/Programmation/Python/00_Compilation/templates/default.pptx",\
"pptx/templates/default.pptx")]
includefiles = ["PIL", "pptx", "KaemmererLogo.gif", "IcoKAG.ico", "modell_211.gif", "modell_111.gif", "titel_111.gif", "titel_211.gif", "Funktion_pdf.py"]
# "path": path,
buildOptions = {"includes": includes,
"excludes": excludes,
"packages": packages,
"zip_includes": zip_includes,
"include_files":includefiles
}
#############################################################################
# preparation des cibles
base = None
if sys.platform == "win32":
base = "Win32GUI"
if sys.platform == "win32":
buildOptions["include_msvcr"] = True
cible_1 = Executable(
script = "pdf2pptx_01-2.py",
base = base,
compress = True,
icon = None,
)
#############################################################################
# creation du setup
setup(
name = "pdf2pptx_01",
version = "1.2",
description = "pdf2pptx_01",
author = "Bruno Clement",
options = {"build_exe": buildOptions},
executables = [cible_1]
)
你知道这个问题吗?
谢谢