使用 cx_Freeze 时出现属性错误

Attribute Error while using cx_Freeze

正在创建我的 python 游戏的 exe。我收到以下错误

我在 setup.py 中的代码是

import cx_Freeze
import os

os.environ['TCL_LIBRARY'] = "C:\Users\Vinayak Singla\Appdata\Local\Programs\Python\Python36-32\tcl\tcl8.6"
os.environ['TK_LIBRARY'] = "C:\Users\Vinayak Singla\Appdata\Local\Programs\Python\Python36-32\tcl\tk8.6"

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

cx_Freeze.setup(
    name="Pongy",
    options={"build_exe": {"packages":["pygame","sys","random","time"],"include_files":["boing.wav","out.wav"]}},
    executables = executables
)

谁能帮我解决这个问题

您可能需要在安装脚本中使用 version。喜欢:

cx_Freeze.setup(
    name="Pongy",
    version='1.0',
    options={"build_exe": {"packages":["pygame","sys","random","time"],"include_files":["boing.wav","out.wav"]}},
    executables = executables
)

希望这能解决您的问题。