使用cx_freeze时出错

时间:2013-09-02 22:56:52

标签: centos cx-freeze setup.py

我在CentOS6上使用cx_freeze(通过Bash),当我执行“Python setup.py build”时,我收到此错误:

$ python setup.py build
File "setup.py", line 11
options=['build_exe':{'excludes':excludes, 'packages':packages, 'include_files':includefiles}]
                    ^
SyntaxError: invalid syntax

这是我的setup.py:

import sys
from cx_Freeze import setup, Executable

includefiles = ['cpu.py']
includes = ['psutil', 'time', 'socket']
excludes=[]
packages=[]
setup(name='CPU Stats',
 version='0.1',
  description='Script to pull CPU Stats',
  options=['build_exe':{'excludes':excludes, 'packages':packages, 'include_files':includefiles}]
  executables=[Executable('cpu.py')]
 )

'Cpu.py'是我要捆绑的脚本。“psutil”,“time”,“socket”是Python模块。

对于我的setup.py,我使用了@Slobodan Stevic的[this] cx_Freeze and Python 3.3

1 个答案:

答案 0 :(得分:1)

据Thomas K评论编辑:

根据docs,选项的语法是:

options={'build_exe':{'excludes':excludes, ...即使用字典,而不是列表。