Convert py to exe

Source: Internet
Author: User

Tool: Python + py2exe must be matched; otherwise, compilation fails.

 

1. Create a py file. For example, file. py can be compiled without syntax errors.

 

2. Compile the py file that generates the EXE, as shown in setup. py:

From distutils. Core import setup
Import py2exe

Setup (console = ['new _ file. py'])

 

3. Open dos and run cmd to save the setup. py file.

Run the following command:

 

Python setup. py py2exe

 

4. After the compilation is passed, there will be two files build and DIST in the above directory, and there will be a file.exe file in DIST, which is the execution file of file. py.

The Dist will be sent to any machine for running.

 

But it does not work if you send a single file.exe file.

 

 

 

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.