【发布时间】:2020-01-12 01:54:42
【问题描述】:
我正在观看有关如何制作视频游戏的 YouTube 教程,现在我们将其转换为 exe,这是我将游戏转换为 exe 的设置代码(不是游戏代码本身):
import cx_Freeze
executables = [cx_Freeze.Executable("pygame sentdex.py")]
cx_Freeze.setup(
name="A bit racey",
options={"build_exe": {"packages":["pygame"],
"include_files":["car.png"]}} #if you have other included files put them here. like fonts.
executables = executables)
当我尝试转换时,会发生这种情况:
PS C:\Users\Damon Tattersfield\Desktop\video game\code\python codes> python setup.py build
File "setup.py", line 9
executables = executables)
^
SyntaxError: invalid syntax
PS C:\Users\Damon Tattersfield\Desktop\video game\code\python codes>
它一直说executables 中的 e 是错误的,即使它对 YouTuber 来说工作正常,我已将其更改为大写 e,删除,重新键入它,但它说这是一个语法错误,当我' m 99% 肯定不是。
这是YouTuber的链接:https://www.youtube.com/watch?list=PLQVvvaa0QuDdLkP8MrOXLe_rKuf6r80KO&v=EY6ZCPxqEtM
我该如何解决? 谢谢...
【问题讨论】:
-
你可能遗漏了一个逗号,无论如何它可能与那个可怜的“e”无关。
-
options后面好像少了一个逗号。即myfunc(a,b c),而不是myfunc(a,b,c)