我在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
答案 0 :(得分:0)
实际上你在packages
之后缺少一个结束的大括号。
请尝试以下行:
options={"build_exe":{"packages":["pygame"]},"include_files":{["cake.bmp", "doctor.bmp", "door.bmp", "pill.bmp", "player.bmp", "wall.bmp", "web.bmp"]}},