Convert Python files to (generate) executable program EXE files in Windows

Source: Internet
Author: User
Convert Python files to (generate) executable files on WindowsProgramEXE file

I will not talk much about it. Python 2.5 + py2exe is required.

Py2exeHttp://sourceforge.net/projects/py2exe/files)(Install it directly)

The procedure is as follows:

1. compile your py file and ensure it is correct. Save it... (Example: C:/old/Test. py)

 

2. edit a py file with the following content and save it as (for example, C:/old/Go. py)

From distutils. Core import setup 
Import py2exe 
Setup (console = ['Test. py'])

The red part indicates the file name saved in step 1.

 

3. Run cmd to enter the file directory (for example, cd c:/old) and run the following command:

Run: Python Go. py Py2exe

The red part is the file name saved in step 2.

 

4. Find the. exe file in the corresponding folder (for example, C:/old/Dist Find Test.exe ) 

Finished!


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.