2016-11-19 120 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

我下載了該線程和其他頁面中提到的所有庫。但仍然不起作用。有沒有辦法確切知道哪些庫丟失? –