I'm trying to build an app using pyinstaller, PyQt5 and qml (see files below) using the following command.
pyrcc5 pyqt5_qml.qrc > pyqt5_qml_qrc.py
pyinstaller -w -F --noupx pyqt5_qml.py
(OSX 10.11.1, python 3.5.0, qt 5.5.1, pyinstaller 3.0)
The pyqt5_qml.py runs fine (open an "Hello world!" window) but the built app complains about module "QtQuick" version 2.4 is not installed. I guess the module has not been included into the built app but I'm not sure how to tell pyinstaller to do it.
pyqt5_qml.py:
import os, sys
from PyQt5 import QtCore, QtWidgets, QtQml
import pyqt5_qml_qrc
def main():
global app
app = QtWidgets.QApplication(sys.argv)
engine = QtQml.QQmlApplicationEngine()
engine.load(QtCore.QUrl('qrc:/hello.qml'))
root = engine.rootObjects()[0]
root.show()
sys.exit(app.exec_())
if __name__ == "__main__":
main()
hello.qml:
import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.Layouts 1.1
ApplicationWindow {
title: qsTr("Window")
Rectangle {
width: 360
height: 360
Text {
anchors.centerIn: parent
text: "Hello World"
}
MouseArea {
anchors.fill: parent
onClicked: {
Qt.quit();
}
}
}
}
pyqt5_qml.qrc:
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>hello.qml</file>
</qresource>
</RCC>