I am trying to get a basic PyQt5 QML project using Windows or Linux. I tried Linux first, and now I'm out of luck. My problem is whenever I try to run it through python main.py, it will complain that the “QtQuick module is not installed” and the “QtQuick.Window module” is not installed.
It seems to me that this is a simple pointer to some way to the QT installation site, but I don’t know where to go from here. Using Qt Widgets works, but not QML.
My main.py file:
import sys
from PyQt5.QtQml import QQmlApplicationEngine
from PyQt5.QtGui import QGuiApplication
def _find_plugins():
import PyQt5
from os import path
paths = [path.abspath(path.join(path.dirname(PyQt5.__file__), 'plugins'))]
import PyQt5.QtCore
PyQt5.QtCore.QCoreApplication.setLibraryPaths(paths)
if __name__ == '__main__':
app = QGuiApplication(sys.argv)
engine = QQmlApplicationEngine()
engine.load('test.qml')
sys.exit(app.exec_())
and my test.qml file:
import QtQuick 2.2
import QtQuick.Window 2.1
ApplicationWindow {
visible: true
width: 640
height: 480
minimumWidth: 400
minimumHeight: 300
}
source
share