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:
- print "foobar"
Create an installation file setup. py:
- from distutils.core import setup
- import py2exe
- setup(console=['foobar.py'])
Run:
- python setup.py py2exe
-
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:
- print "foobar"
The following operations are performed in the decompressed directory. Configure pyinstaller:
- python Configure.py
Generate the spec file:
- python Makespec.py -F -c foobar.py
-
Run:
- 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.