Python (2): Package python into an executable file app,
The original connection is: http://blog.csdn.net/freewebsys/article/details/46683645 reprint please be sure to indicate the source!
1. Package the mac program into an app
One pyinstaller has been tested in two solutions. No package is successful.
Py2app can be packaged successfully.
2. Install py2app
First install a gui framework wxpython
Refer:
Http://wiki.wxpython.org/
Http://wiki.wxpython.org/Getting%20Started
Official py2app Website:
Https://pythonhosted.org/py2app/
Installation:
sudo easy_install -U py2app
3. Package the 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_ANY, "Hello World") # A Frame is a top-level window.frame.Show(True) # Show the frame.app.MainLoop()
Generate the setup file:
Py2applet -- make-setup hello. py # package: python setup. py py2app-
Generate file:
Double-click a few to run.
4. Summary
The original connection is: http://blog.csdn.net/freewebsys/article/details/46683645 reprint please be sure to indicate the source!
Because the wxpython library is installed on the local machine, all tasks can be run directly. If you want to use it on A computer without the sdk installed, remove the-A parameter and package all dependencies.
# Self-developed, fast packaging. Python setup. py py2app-A # For other computers without sdks, including the lib library. Python setup. py py2app
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.