刚刚安装了 QtOpenGL 但无法导入它(来自 Python)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1419650/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 22:13:12  来源:igfitidea点击:

Just installed QtOpenGL but cannot import it (from Python)

pythonopenglpyqtapt-getpyopengl

提问by Nathan

I just installed it with apt-get on debian linux with

我刚刚在 debian linux 上用 apt-get 安装了它

apt-get install libqt4-opengl

the rest of PyQt4 is available, but I cant get to this new module.

PyQt4 的其余部分可用,但我无法访问这个新模块。

from PyQt4 import QtOpenGL

raises ImportError. any idea what to do?

引发导入错误。知道该怎么做吗?

回答by John Paulett

Did you forget to install the Python bindings?

您是否忘记安装 Python 绑定?

apt-get install python-qt4-gl

回答by Nick Crews

For Python3, I had to do sudo apt-get install python3-pyqt4.qtopengl

对于 Python3,我必须这样做 sudo apt-get install python3-pyqt4.qtopengl