Creating onfile exe for Python + QML based deployment on Desktop
-
wrote on 20 Jun 2022, 09:19 last edited by
Hi,
I have created a desktop application with python and qml.
Now want to create a single exe from this.
Please let me know how it can be done.SF
-
Hi and welcome to devnet,
If memory serves well, nuitka has support for Qt.
-
wrote on 21 Jun 2022, 09:37 last edited by
Hi @Sudhir-F,
As @SGaist metioned before, you can use Nuitka to build and create an executable from Python code.
Nuitka can be installed using PIP Installer:
python -m pip install nuitka
Build our program with --onefile command option to generate a single executable file. Use --standalone command option to generate a whole program.dist folder
Depending on the Python bindings you are using you should add one of the following command options:--plugin-enable=pyqt5 --plugin-enable=pyqt6 --plugin-enable=pyside2 --plugin-enable=pyside6
Nuitka plugin list can be viewed using python -m nuitka --plugin-list command.
Bellow you can find comand example including compilation of a resources folder:
python -m nuitka --plugin-enable=pyside6 --follow-imports --windows-disable-console --windows-icon-from-ico="resources/myIcon.ico" --include-data-dir=./resources=resources --onefile "myProgram.py"
As an alternative to Nuitka you can also use PyInstaller or others.
Regards
1/3