Here we are going to learn, how to convert a .py (Python file) into a .exe file.
What are .exe files?
A .exe file is a common filename extension denoting an executable file ( the main execution point of the computer programming) for the Microsoft window.
In simple words, we create lots of programs per day and want to share them with the world but not everyone has an environment with a compiler and interpreter to run our code. But everyone has an operating system and in windows .exe file executes the program.
(For more information on Convert Python file to .exe file, kindly refer to this documentation https://www.geeksforgeeks.org/convert-python-script-to-exe-file/)
Let's Convert Random Password Generator GUI into an executable file.
(for understanding how we build random password generator using GUI read our previous blog:
Step 1:Install the Pyinstaller Package
In the cmd, type the following command to install the pyinstaller package .
pip install pyinstaller
Step2: Save your Python Script
Now you’ll need to save your Python script at your desired location.
I have saved my random password generator script in :
Step3:Create the Executable using Pyinstaller
Now you’ll be able to create the executable from the Python script using pyinstaller. Simply go to the Command Prompt, and then go to your file location using cd command.
Next, use the following code to create the executable file in command prompt:
pyinstaller --onefile pythonFileName.py
In My case file name is random_password_generator.py:
Done!!!!. Your executable file is created it's that simple.
Step 4: Run the Executable
Your executable should now get created at the location that you specified. Under the folder name dist.
Once you click on the file, you should be able to launch your program and now it is an application so it will run on any device.
Download the project from:
Want to know how we created Random Password Generator Using Tkinter read our blog :
Random Password Generator Using Tkinter
Complete Guide To Create A Random Password Generator using Python GUI(Tkinter module)
Visit Our Website:
Learn, Innovate & Inspire - Platforuma®
Platforuma is an ED-Tech startup based in Indore, providing learning and Arduino Training, Python Learning, Robotics…
Author: Priyanka Prasad