How to compile pyqt5 or pyside2 code with nuitka

Hi guys

with this method you can compile python script with nuitka for:

  • more 300% speed running
  • optimize python script to c code
  • more Compatible with any os
  • cross platform compilation
  • python 2.7 , python 3.4 <= 3.8 support
  • compile base x86 , x64 and ARM
  • compile python script via MSVC , Mingw , Clang compilers
  • 100% Native after compile your project
  • You can make pyd modules very easy with nuitka and 100% native

How to compile python script with nuitka in windows

1 - first install nuitka

pip install nuitka

2 - download mingw64 , mingw32 compiler and add environment mingw\bin

3 - Now ready your code for compilation.

4 - use this command for compile pyqt5 or pyside2

Pyqt5 and Pyside2 and All QT Plugins

nuitka main.py --show-progress --recurse-all --standalone --plugin-enable=qt-plugins --include-qt-plugins=all --windows-disable-console

Pyqt5 and Pyside2 QT style plugins

nuitka main.py --show-progress --recurse-all --standalone --plugin-enable=qt-plugins --include-qt-plugins=sensible,styles --windows-disable-console

Nuitka plugin list

nuitka --plugin-list

2 Likes

Hello, thanks for your tutorial, this worked with PySide2 (after installed Visual Studio 2019 it worked), but I needed to copy some folders (platforms and imageformats) from PySide2 LIB to the dist generated, now the program is working perfect, thanks Javad!