cx_freeze “cannot get zipimporter”

痴心易碎 提交于 2019-12-24 15:14:33

问题


The last program I wrote in Python27 (in windows7 64x, exe with cx_freeze 3.4.1) work without problem on almost all computers, but with one computer (also with windows7 64x) I get the following error-message :

cx_Freeze Fatal Error

cannot get zipimporter instance

I tried to fix it with the following :

  • I deleted all non-ASCII from the code (included those in the comments).

  • I added the modul "zlib" to the includes in the setup and in the import of the program.

  • I added "include_msvcr" : True to the build-options of the setup for the compatibility with other windows-versions.

But it still doesn't work.

Here is my 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]
    )

Have you an idea of the problem ?

Thanks

来源:https://stackoverflow.com/questions/17447833/cx-freeze-cannot-get-zipimporter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!