The text of this text connection is: http://blog.csdn.net/freewebsys/article/details/46683645 reprint please must indicate the source!
1,MAC programs packaged into apps
There are two scenarios a pyinstaller has tested. Not packaged successfully.
Py2app can be packaged successfully.
2, install Py2app
First install a GUI framework Wxpython
References:
http://wiki.wxpython.org/
http://wiki.wxpython.org/Getting%20Started
Py2app Official website:
https://pythonhosted.org/py2app/
Installation:
sudo easy_install -U py2app
3. Package App
It's quite simple:
For example, a simple gui,hello.py
#!/usr/bin/env pythonimport wxapp = wx.App(False) # Create a new app, don‘t redirect stdout/stderr to a window.frame = wx.Frame(None, wx.ID"Hello World"# A Frame is a top-level window.frame.Show(True) # Show the frame.app.MainLoop()
To generate the setup file:
py2applet --make-setup hello.py#打包:python setup.py py2app -A
Generate File:
Double-click on a few to execute.
4, summary
The text of this text connection is: http://blog.csdn.net/freewebsys/article/details/46683645 reprint please must indicate the source!
Due to the installation of the Wxpython library, all can be directly executed, assuming that the computer does not install the SDK to use, remove-A-parameter, will be all the dependencies are packaged.
#自己开发。打包速度快。
python setup.py py2app -A#给其它没有sdk的电脑使用,包含lib库。python setup.py py2app
Python (2): Python packaged as a run-to-file app