PyInstaller packaging

  Kiến thức lập trình

I’m creating a GUI application in python using PyQt5. Here is the first lines of my code:

import sys
import json
import re
import os
from PyQt5.QtWidgets import QApplication, QWidget, QDesktopWidget, QPushButton, QLabel, QHBoxLayout,  QLineEdit, QGridLayout, QMessageBox, QCheckBox, QComboBox
from PyQt5.QtCore import Qt, QPoint, QDateTime
from PyQt5.QtGui import QMouseEvent, QPixmap, QBitmap, QColor, QPainterPath
from qt_material import apply_stylesheet

...

For some reason when I try to pack using PyInstaller using the:

pyinstaller --noconsole --onfile myproject.py

I get the following error in the console window:

Aborting build process due to attempt to collect multiple Qt bindings packages: attempting to run hook for 'PyQt6', while hook for 'PyQt5' has already been run! PyInstaller does not support multiple Qt bindings packages in a frozen application - either ensure that the build environment has only one Qt bindings package installed, or exclude the extraneous bindings packages via the module exclusion mechanism (--exclude command-line option, or excludes list in the spec file).

I don’t understand it because I don’t use PyQt6, or do I?

LEAVE A COMMENT