cover-img

20 December, 2021

How to create installers for your Python application?🤔
From creating pyinstaller executable to building deb package and inno setup installer.

Contributors

Jothin Kumar

2

2

0

Requirements
1. Debian operating system.
2. Windows operating system with Python 3, pip and inno setup installed.
Creating inno setup installer (on windows)
In order to create an installer, we must convert the application script to executable. We can do this using pyinstaller.
Step 1: create a directory "my_app".
Step 2: Create a new file "my_app/app.py" and copy the following contents to it:
Step 3: Navigate to "my_app" directory and run the following command in CMD:
Step 4: Wait for the command to complete and open inno setup compiler.
Step 5: On the inno setup welcome screen, click "Create a new script file using the Script Wizard" and hit ok.
Step 6: Follow on screen instructions (main executable file is in "my_app/dist/app.exe").
Step 7: Compile the script and done!
Creating deb package (On Debian OS)
Just like windows, we must create an executable from our script for deb package.
Step 1: Create a directory "my_app"
Step 2: Create a new file "my_app/app.py" and copy the following contents to it:
Step 3: Navigate to "my_app" directory and run the following command in terminal:
Step 4: wait for it to complete and create the following directories.
Step 5: Create a file "my-app_1.0.0/DEBIAN/control" and copy the following contents into it.
Step 6: Create a file "my-app_1.0.0/usr/share/applications/my-app.desktop" and copy the following contents into it.
Step 7: Copy all files and folders from "my_app/dist" to "my-app_1.0.0/my_app"
Step 8: navigate to the parent directory of "my-app_1.0.0" and execute the following command:

dpkg-deb --build my-app_1.0.0

Step 9: Wait for it to complete and done! You will find a deb package named "my-app_1.0.0.deb"
Thank you!
python
linux
windows
pyinstaller
ubuntu

Copyright © 2022 Jothin Kumar

Built with Showwcase