How to convert Python File into EXE – LLODO


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.

How to create EXE files from Python code on Windows

EXE is the name of a file extension that denotes executable files on Microsoft Windows.

How to convert Python File into EXE

To convert Python files to EXE, we will use the open source Python package called auto-py-to-exe.

How to convert Python File into EXE 14

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.

How to convert Python File into EXE 15

After the installation is done, we can run it directly auto-py-to-exe from the command line itself and see the output.

How to convert Python File to EXE 16

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.

How to convert Python File into EXE 17

Once done specifying the script location, select the output location as shown in the screenshot below then click the blue button.

How to convert Python File to EXE 18

As soon as you click “CONVERT .PY TO EXE”, the next window will look like this:

How to convert Python File to EXE 19

How to convert Python File into EXE 20

When you open the output file, you will see the GUI EXE file:

How to convert Python File into EXE 21

The output will look like this:

How to convert Python File into EXE 22

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.



Link Hoc va de thi 2021

Chuyển đến thanh công cụ