How to compile pyqt5 or pyside2 code with nuitka

Heads up! You've already completed this tutorial.

Javad | 2020-08-20 19:16:05 UTC | #1

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


gsmprinter | 2020-11-06 14:06:13 UTC | #3

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!


Well done, you've finished this tutorial! Mark As Complete
[[ user.completed.length ]] completed [[ user.streak+1 ]] day streak

How to compile pyqt5 or pyside2 code with nuitka was written by Martin Fitzpatrick .

Martin Fitzpatrick has been developing Python/Qt apps for 8 years. Building desktop applications to make data-analysis tools more user-friendly, Python was the obvious choice. Starting with Tk, later moving to wxWidgets and finally adopting PyQt.