cx_freeze设置脚本zip

时间:2013-08-14 09:12:48

标签: python cx-freeze

我正在使用cx_Freeze和以下安装脚本:

exe = Executable(
    script="pyWindowAllignmentGUI.py",
    base="Win32GUI"
    )

setup(
    name = "pyWindowAllignmentGUI",
    version = "0.1",
    description = "An example wxPython script",
    executables = [exe]
    )

这很好用。 现在我尝试使用此安装脚本将所有libarys压缩为zip文件

build_exe_options={"compressed"}

exe = Executable(
    script="pyWindowAllignmentGUI.py",
    base="Win32GUI"
    )

setup(
    name = "pyWindowAllignmentGUI",
    version = "0.1",
    options = {"build_exe":build_exe_options},
    description = "An example wxPython script",
    executables = [exe]
    )

但是我收到以下错误:

Traceback (most recent call last):
  File "setup.py", line 26, in <module>
    executables = [exe]
  File "d:\Program Files (x86)\Python3.2.3_64bit\lib\site-packages\cx_Freeze\dist.py", line 365, in setup
    distutils.core.setup(**attrs)
  File "d:\Program Files (x86)\Python3.2.3_64bit\lib\distutils\core.py", line 109, in setup
    _setup_distribution = dist = klass(attrs)
  File "d:\Program Files (x86)\Python3.2.3_64bit\lib\site-packages\cx_Freeze\dist.py", line 23, in __init__
    distutils.dist.Distribution.__init__(self, attrs)
  File "d:\Program Files (x86)\Python3.2.3_64bit\lib\distutils\dist.py", line 233, in __init__
    for (opt, val) in cmd_options.items():
AttributeError: 'set' object has no attribute 'items'

我试图根据这个网站使用“压缩”参数: http://cx-freeze.readthedocs.org/en/latest/distutils.html#distutils 但我似乎做错了什么? 那么如何使用压缩参数呢?

更新

我发现这就是方法:

build_exe_options={"compressed":True}

exe = Executable(
    script="pyWindowAllignmentGUI.py",
    base="Win32GUI"
    )

setup(
    name = "pyWindowAllignmentGUI",
    version = "0.1",
    options = {"build_exe":build_exe_options},
    description = "An example wxPython script",
    executables = [exe]
    )

并且我发现,默认情况下压缩的参数为True。

因此,我的构建目录中有一个library.zip,其中存储了所有python文件。 但我的构建文件夹中仍然有几个.dll和一些.pyd文件。 (python32.dll,pythoncom32.dll,pywintypes32.dll,tcl85.dll,tk85.dll,unicodedata.pyd,win32api.pyd,win32gui.pyd,..)

是否可以以一种zip文件的方式配置设置脚本?

0 个答案:

没有答案