cx-Freeze executable ImportError: No module named 'zipfile'

烂漫一生 提交于 2019-12-24 17:57:35

问题


I'm on Windows 7, as are all potential users of my program. I packaged a Python program I wrote into an executable file using cx_Freeze, with the following command:

python setup.py build

This generates a build directory that contains my_program.exe. The executable works flawlessly on my computer, but on a coworker's machine, it throws an exception:

ImportError: No module named 'zipfile'

Here's my setup.py, where zipfile is explicitly included (and it's definitely in library.zip):

import sys
from cx_Freeze import setup, Executable

base = None
if sys.platform == "win32":
    base = "Win32GUI"

setup(
   name='Z-Wizard',
   version='0.1',
   description='Z1/Z2 data extraction tool',
   author='Liz Rosa',
   author_email='me@url',
   options = {
      'build_exe': {
         'packages': ['zipfile']
      }
   },
   executables = [Executable('my_program.py', base=base)]
)

The traceback is quite long; there's a screenshot at the URL below. It apparently involves a series of functions in _bootstrap.py. I'm not quite sure what's going on here. Also, "C:\Users\lizr..." is my home directory, not hers. Why does it appear in the traceback on her computer? In case it's not obvious, I don't know much about the freezing process.

http://i.imgur.com/cAQKWxq.png

来源:https://stackoverflow.com/questions/32363919/cx-freeze-executable-importerror-no-module-named-zipfile

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