1、安装py2app
首先安装一个gui框架 wxpython
安装:pip install py2app
2、打包app
比如一个简单的gui,hello.py
!/usr/bin/env python import wx app = wx.App(False) # Create a new app, don't redirect stdout/stderr to a window. frame = wx.Frame(None, wx.ID_ANY, "Hello World") # A Frame is a top-level window. frame.Show(True) # Show the frame. app.MainLoop()
生成setup文件:
py2applet --make-setup hello.py
打包:
python setup.py py2app -A
生成文件:
双击可以运行了。