#Hello.py
import Tkinter
root=Tkinter.Tk()
label=Tkinter.Label(root,text="Hello,py2exe!")
label.pack()
button=Tkinter.Button(root,text="Button")
button.pack(side=Tkinter.LEFT)
root.mainloop()
#setup.py
from distutils.core import setup 
import py2exe 
setup(windows=['Hello.py']) 

Windows命令行在工作目录下运行:

python setup.py py2exe

工作目录中新增两个文件夹:build和dist

目标可执行文件Hello.exe在dist中。

相关文章:

  • 2022-01-13
  • 2022-12-23
  • 2022-12-23
  • 2022-01-03
  • 2021-12-15
  • 2021-11-07
  • 2021-12-01
猜你喜欢
  • 2021-11-22
  • 2022-01-19
  • 2021-12-30
  • 2021-10-16
  • 2021-07-07
  • 2021-07-08
相关资源
相似解决方案