Python使用cx_Freeze进行exe

时间:2016-05-20 16:25:42

标签: python syntax exe

我正在关注如何将.py更改为.exe的新浪的教程,我已经完成了setup.py,但是当我输入时' python setup.py build'进入CMD它说我有语法错误。我不确定代码有什么问题,但它说有错误。请帮帮忙?

import cx_Freeze

cx_Freeze.executables = [cx_Freeze.Executable("Inspire.py")]

cx_Freeze.setup(
    name="Inspire"
    options={"build_exe":{"packages":["os","sys","random","time"]}}
    description="A text-based RPG game"
    executables=executables
    )

错误是: 文件setup.py第7行

options={"build_exe":{"packages":["os","sys","random","time"]}}
      ^
Syntax error: invalid syntax

1 个答案:

答案 0 :(得分:0)

您的关键字参数之间似乎缺少逗号。

试试吧!

cx_Freeze.setup(
    name="Inspire",
    options={"build_exe":{"packages":["os","sys","random","time"]}},
    description="A text-based RPG game",
    executables=executables
    )