Ich versuche, ein grundlegendes PyQt5-QML-Projekt mit Windows oder Linux zu bekommen. Ich habe zuerst versucht, Linux und ohne Glück versuche ich Windows jetzt. Mein Problem ist, wenn ich versuche, es über python main.py auszuführen, es wird sich beschweren, dass "Modul" QtQuick "nicht installiert ist" und "Modul" QtQuick.Window "nicht installiert ist".PyQt5-Modul "QtQuick" ist nicht installiert
Ich glaube, das ist ein einfacher Hinweis auf einen Pfad zum QT-Installationsort, aber ich weiß nicht, wohin ich von hier aus gehen soll. Die Verwendung von Qt Widgets funktioniert, aber nicht von QML.
Meine main.py Datei ist:
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__':
# _find_plugins()
app = QGuiApplication(sys.argv)
engine = QQmlApplicationEngine()
engine.load('test.qml')
sys.exit(app.exec_())
und meine test.qml Datei ist:
import QtQuick 2.2
import QtQuick.Window 2.1
ApplicationWindow {
visible: true
width: 640
height: 480
minimumWidth: 400
minimumHeight: 300
}
Wie haben Sie pyqt5 installiert? –