How to compile an exe file in Python

Source: Internet
Author: User

This article describes how to compile an exe file using a Python file. The following article describes how to compile an exe file using a Pthon file, I hope you will find some benefits after browsing.


It is cool to compile an exe file in Python and translate Python into an exe file. Many software can implement this function.

1. py2exe

Download the File Link first). The installation process is simple. You just need to go to the next step. Create an example file foobar. py:

 
 
  1. print "foobar"  

Create an installation file setup. py:

 
 
  1. from distutils.core import setup  
  2. import py2exe  
  3. setup(console=['foobar.py'])  

Run:

 
 
  1. python setup.py py2exe  
  2.  

Compile the Pthon file into an exe file and download the file link first.) extract the file to a proper location. Create an example file foobar. py:

 
 
  1. print "foobar"  

The following operations are performed in the decompressed directory. Configure pyinstaller:

 
 
  1. python Configure.py  

Generate the spec file:

 
 
  1. python Makespec.py -F -c foobar.py  
  2.  

Run:

 
 
  1. python Build.py foobar/foobar.spec  

Ps: py2exe can also be packaged into only one exe package without library.zip. The preceding section describes how to compile an exe file with a Pthon file.

Related Article

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.