2016-11-19 119 views
-1

我正在使用Debian 8和python 2.7,anaconda环境。PyQt5 + QtOpenGL:QXcbIntegration错误

这是我的代码:

from PyQt5 import QtCore, QtWidgets, QtOpenGL 
import sys 


class Ui_MainWindow(QtWidgets.QMainWindow): 
    def __init__(self, parent=None): 
     super(Ui_MainWindow, self).__init__(parent, flags=QtCore.Qt.FramelessWindowHint) 
     self.setAttribute(QtCore.Qt.WA_DeleteOnClose) 
     self.setupUi(self) 

    def setupUi(self, MainWindow): 
     MainWindow.setWindowModality(QtCore.Qt.ApplicationModal) 
     MainWindow.setFixedSize(800, 600) 
     self.map = Map(self) 


class Map(QtOpenGL.QGLWidget): 
    def __init__(self, parent=None): 
     super(Map, self).__init__(parent) 
     self.move(11, 148) 
     self.setFixedSize(545, 416) 

app = QtWidgets.QApplication(sys.argv) 
form = Ui_MainWindow() 
form.show() 
sys.exit(app.exec_()) 

我得到这个错误:

QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled 

难道我做错了什么?

在此先感谢。

编辑:

这是我的Qt的./configure

这是我glxinfo

但仍然没有工作。

+1

该代码适用于python3.5 + win7 + pyqt5.7,问题在于opengl方面.... glxinfo说什么? – BPL

+0

http://pastebin.com/tgQVrpFj。谢谢! –

回答

0

您可能会缺少一些库。见this from thread。如果这不起作用,搜索那个错误消息有很多解决的问题)),许多人表示获取缺少的库修复了这个问题。

+0

我下载了该线程和其他页面中提到的所有库。但仍然不起作用。有没有办法确切知道哪些库丢失? –