python-Convert to EXE (Py2exe)

Source: Internet
Author: User
Tags python script

First, Introduction:

Py2exe is a tool for converting a Python script into a standalone executable program (*.exe) on Windows so that you can run the executable program on a Windows system without having to install Python.
Py2exe has been used to create wxpython,tkinter,pmw,pygtk,pygame,win32com client and server, and other standalone programs.

Second, installation Py2exe:

Download and run the Py2exe version of the installer that corresponds to the python you installed from Http://prdownloads.sourceforge.net/py2exe, which installs Py2exe and the corresponding example, which are installed in lib\ The Site-packages\py2exe\samples directory.

Third, the use of Py2exe:

If you have a name of Gj_check_ version.py.py python script, you want to convert it to an executable program running on Windows and run on a Windows system that doesn't have Python installed, first you should write a setup script for the publisher, such as: setup.py, which is inserted before the setup function. Sentence import Py2exe.
The setup.py example is as follows:

 from Import Setup Import py2exesetup (console=["gj_check_version.py"])

Open the command line, navigate to the directory where the. py file is located, and enter the command:

Python setup.py Py2exe

By default, Py2exe creates the following required files under Directory dist:

python-Convert to EXE (Py2exe)

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.