NameError: 'exit' 未在 cx_Freeze python 中定义

问题描述

编辑

这是我的 GUI 代码

from tkinter import *
import builtins as bi

root = Tk()
root.title("hello worlds")

btn = Button(root,text="hello worlds",command=bi.exit)
btn.pack()

root.mainloop()

这是 setup.py

import cx_Freeze as cf
import sys

executable = [cf.Executable("asd.py")]

cf.setup(
    name = "asd",executables = executable,options = {"build_exe" : {"packages" : ["tkinter"]}}
)

当我构建脚本时它工作正常但是当我运行可执行文件时它显示一个错误

AttributeError: module 'builtins' has no attribute 'exit'

我也不能使用其他内置函数,我试图重新定义退出函数。但它也显示一个错误

RecursionError: maximum recursion depth exceeded

我该如何解决这个问题?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)