cx_Freeze中的语法错误

时间:2015-08-09 17:34:27

标签: python python-3.x pygame cx-freeze

我在python中编写了一个程序,在转换为exe文件时,我收到了语法错误。

我的代码:

import cx_Freeze

executables = [cx_Freeze.Executable('Cake Rush.py')]

cx_Freeze.setup(
    name='Cake Rush',
    options={'build_exe':{"packages":['pygame'], 'include_files':['cake.bmp','doctor.bmp','door.bmp','pill.bmp','player.bmp','wall.bmp','web.bmp']}},
    description = 'Cake Rush Game',
    executables = executables
    )

错误:

options={"build_exe":{"packages":["pygame"],"include_files":["cake.bmp", "doctor.bmp", "door.bmp", "pill.bmp", "player.bmp", "wall.bmp", "web.bmp"]}},

SyntaxError: invalid syntax

1 个答案:

答案 0 :(得分:0)

实际上你在packages之后缺少一个结束的大括号。

请尝试以下行:

options={"build_exe":{"packages":["pygame"]},"include_files":{["cake.bmp", "doctor.bmp", "door.bmp", "pill.bmp", "player.bmp", "wall.bmp", "web.bmp"]}},