我在PYTHON 3.x中有一个程序,我试图在.exe中转换flie .py。 我尝试使用pyinstaller,它没有工作,.exe从未出现过。 现在我尝试使用cx_Freeze,下面是我的代码,设置文件及其给出的错误:
from tkinter import *
import tkinter as tk
win=tk.Tk()
win.title('Table')
win.iconbitmap('cubic.ico')
win.resizable(width=False,height=False)
win.minsize(190,120)
lb=Label(win,text='Digite um numero ',font='Helvetica 12 bold')
lb.grid(row=1, column=5)
lb2 = Label(text='')
e=Entry(win)
e.grid(row=2,column=5)
win.bind("<Return>", lambda x: click())
win.bind("<Delete>",lambda x:reset())
win.bind('<Escape>',lambda x:exit())
def click():
global c
c = e.get()
print('Numero requisitado: ', c)
reset()
make_label()
#w, h = pyautogui.size()
def make_label():
global lb2
txt = []
for b in (range(0, 11)):
c = e.get()
txt.append('{} x {} = {} '.format(c, b, int(b)*int(c)))
text = '\n'.join(txt)
lb2 = Label(text=text)
lb2.grid(row=5, column=5)
def reset():
global lb2
# lb2.pack_forget()
lb2.destroy()
lb2 = Label()
lb2['text'] = ''
lb2.grid(row=5, column=5)
bt1 = Button(win, text='GO', bg='lightblue', command=click)
bt1.grid(row=3,column=5)
bt2 = Button(win, text='RESET', bg='lightblue', command=reset)
bt2.grid(row=4,column=5)
win.mainloop()
我的setup.py代码:
from cx_Freeze import setup,Executable
setup(
name='Tabuada',
version='1.0',
description='Tabuada',
executables=[Executable('TABUADATKINTER.py')]
)
我只想要一个.exe文件,我可以从我的桌面运行,而无需打开python IDE。 请帮助我,我试着看看其他问题,但是任何帮助过我。