To create an (.exe) executable application file from a python script.
1.Install Inno Setup Compiler free application and Pyinstaller.
Open windows shell and run :
pip install pyinstaller
-
Save Python script with all the resources in one folder.
-
Open folder and press 'Shift + right click' select Open PowerShell window.
Run below commands:
- If no custom icon file were used.
pyinstaller myprogram.py
- With custom icon file (-F -i "mylogo.ico" command).
pyinstaller -F -i "mylogo.ico" myprogram.py
-
( mylogo.ico = icon file name, myprogram.py = Python file name )
-
If you want your executable application with no console running (--noconsole command) behind your application then go with the below line.
pyinstaller -F -i "mylogo.ico" myprogram.py --onefile --noconsole
- If you want your executable application with additional file (--add-data command) then go with the below line.
pyinstaller -F -i "mylogo.ico"--add-data "Additionalimage.png;." myprogram.py --noconsole
- Go to dist folder and get application file, delete remain file except for resources.
Congratulations ! 🤩 you successfully created your standalone application.
However if you want your application as Setup.exe then windows installer will extract the installation resources from itself and manage their installation directly.
-
Open Inno setup to make (.exe) file which is Installable/Executable in Windows PC, select Create a new script file using Script Wizard and browse to select your application.
-
Select all required things for your application such as Icon of setup file, Before installation document, Licence .etc
-
Click Yes to all, in the end go to Output Folder get setup file of application and click on open to install.
Yor're done !
✔️ Save the resources in one folder, Do not save the folder inside another folder.
It will not give full permission to execute the commands. # ParentContainsErrorRecordException
✔️ Check Spellings before running the commands, Do not put any space in your main python (.py) programme file name.
File not found show
✔️ Do not use the icon word as a name of your icon (.ico) file, always use a different name.
It will show no icon file found.
✔️ Do not Close Powershell window until Building EXE from EXE-00.toc completed successfully Message not shows.
- Pyinstaller
- Inno Setup Compiler
- Real Python
- Feel free to report issues