You have just finished writing a program in Python, but instead of sending pure code over, you want to convert the python into an EXE file that is easy for the recipient to use. See the instructions below, you can convert Python File into EXE on Windows simply.
Join the channel Telegram of the AnonyViet 👉 Link 👈 |
EXE is the name of a file extension that denotes executable files on Microsoft Windows.
How to convert Python File to EXE
To transfer files Python to EXE, we will use an open source Python package called auto-py-to-exe.
To install auto-py-to-exe, the basic requirement is that we have to install Python and pip on the developer machine.
To install we will have to execute the command pip install auto-py-to-exe
on the command line.
After the installation is done, we can run it directly auto-py-to-exe
from the command line itself and see the output.
I will use simple code to create GUI in Python and convert it to EXE.
Once you open the auto-py-to-exe package just add your Python script path as shown in the screenshot below.
Once done specifying the script location, select the output location as shown in the screenshot below then click the blue button.
As soon as you click “CONVERT .PY TO EXE”, the next window will look like this:
When you open the output file, you will see the GUI EXE file:
The output will look like this:
Note: Make sure you have installed all python packages and libraries used in python script via pip as auto-py-to-exe will combine all available libraries in machine and then create EXE file. If you don’t do this, the EXE file when issued to another machine will get a module not found error.