Converting .py to .exe

To share your Python projects with the world it needs to be converted from .py to .exe file, exe file is an executable file format. It contains a program and has the ability to run as a program in computer. It does not require any import statements to execute.

Let's get started

Step 1:

Install the library pyinstaller. You can do so by typing the following code into your command prompt.

pip install pyinstaller

Step 2:

Go to the folder where .py file is located. You’ll see few folder created newly. Now Press the shift button and simultaneously right-click to open PowerShell window.

Step 3:

Type the following command:

pyinstaller --onefile ''

It will take some time to finish the process depending on the size of your project. You will get a "Building EXE completed successfully" message.

Step 4:

Open your dist folder, here you will find your .exe file and you are good to go!!!