Python (2): Python packaged as a run-to-file app

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.