Anaconda和python qt 5.6,支持opengl

时间:2016-11-03 11:11:22

标签: python qt opengl anaconda

我在使用python 2.7试图让我的应用程序在anaconda环境中使用python Qt5.6时遇到了大量问题。

我使用conda包在https://anaconda.org/anaconda/pyqt

安装它

列出anaconda环境显示我只安装了qt 5.6:

pyqt                      5.6.0                    py27_0    anaconda
qt                        5.6.0                         1    anaconda

现在,我有一个简单的应用程序:

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

app = QApplication(sys.argv)

view = QQuickView()
view.setSource(QUrl("ui/example.qml"))
view.show()

示例qml文件如下:

import QtQuick 2.0

Rectangle {
    width: 300; height: 100
    color: "gray"

    Text {
        id: helloworld
        text: "Hello world!"
        color: "blue"
        font.pointSize: 32
    }
}

现在,我调用它时出现以下错误:

QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
Failed to create OpenGL context for format QSurfaceFormat(version 2.0, options QFlags(), depthBufferSize 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize 8, samples -1, swapBehavior 2, swapInterval 1, profile  0) 
Aborted (core dumped)

0 个答案:

没有答案