To distribute your app, you want to have a single executable program instead of source code. This is easier than giving users many Python files.

Why? A user can start your app with a single click. On Windows it’s a .exe. On Mac OS X it’s a .dmg

Related Course: Create GUI Apps with Python PyQt5

Make Executable

Install Toolchain

You can use fbs to create a program that can be run.

1
2
3
4
5
sudo apt3 install python3-venv
python3 -m venv venv
source bin/activate
pip3 install fbs PyQt5==5.9.2 PyInstaller==3.4
fbs startproject

Then you’ll be asked for name of the app and the author

1
2
3
4
5
App name [MyApp] : hello
Author [Linux] : boss
Mac bundle identifier (eg. com.boss.hello, optional):

Created the src/ directory.

Take a look at the file /venv/src/main/python/main.py. That’s the source code for your program.

Type fbs run to start the program.

python pyqt to exe

Create the Executable

You start apps from a binary. On Windows thats a .exe, on Mac that’s a .dmg

To make a standalone executable type

fbs freeze.

It then creates the program in target/. If you named the app hello, it’s target/hello/hello.

Setup

Software is always installed using an installer. You can create your own installer with the command fbs installer.

On Windows and Mac this will create a graphical setup program (setup wizard).

On Linux it creates a package file (.deb, .rpm), that can be installed with the package manager.

If you are new to Python PyQt, then I highly recommend this book.

Download Examples