模块“QtQuick”未安装ubuntu 14.04

时间:2017-06-29 09:00:10

标签: python-3.x qt qml pyqt5

我是桌面应用程序的新手。

我正在尝试使用PyQt5和QML创建一个页面并遵循此tutorial

这是我的pythonFile.py

import sys
from PyQt5.QtCore import QUrl
from PyQt5.QtWidgets import QApplication
from PyQt5.QtQuick import QQuickView

#   Main Function
if __name__ == "__main__":
    # create Main App
    myApp = QApplication(sys.argv)
    # create Lable and set its properties
    appLabel = QQuickView()
    appLabel.setSource(QUrl("basic.qml"))

    # Show the label
    appLabel.show()

    # Execute Application & Exit
    myApp.exec_()
    sys.exit()

basic.qml

import QtQuick 2.0


Rectangle{
    width : 250;
    height : 175;

    Text{
        id : helloText
        anchors.verticalCenter : parent.verticalCenter;
        anchors.horizontalCenter : parent.horizontalCenter;
        text: "Hello World!!!\n Traditional first app using PyQt5"
        horizontalAlignment : Text.AlignHCenter
    }
}

当我尝试运行python文件时,它显示错误:

file:///path-to-file/basic.qml:1:1: module "QtQuick" is not installed 
     import QtQuick 2.0 
     ^

我试图找到解决方案,但它仅适用于Windows,而不适用于ubuntu 14.04。 我被困在这里建议我解决这个问题。

提前致谢。

0 个答案:

没有答案
相关问题