conda create -n OpenGL python=3.82. 现下载对应的OpenGL版本
官网下载地址:链接:https://www.lfd.uci.edu/~gohlke/pythonlibs/
下载相应的版本
3. 进入conda虚拟环境conda activate OpenGL
cd 到刚下载文件的文件夹,执行pip安装命令
pip install PyOpenGL-3.1.6-cp38-cp38-win_amd64.whl pip install PyOpenGL_accelerate-3.1.6-cp38-cp38-win_amd64.whl
此时 已经安装成功。pip list或者conda list可以查看到安装好的opengl包名字
4. 验证测试from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
def Draw():
glClear(GL_COLOR_BUFFER_BIT)
glRotatef(0.5, 0, 1, 0)
glutWireTeapot(0.5)
glFlush()
glutInit()
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA)
glutInitWindowSize(400, 400)
glutCreateWindow("test")
glutDisplayFunc(Draw)
glutIdleFunc(Draw)
glutMainLoop()
运行之后可以看到一个旋转的茶壶



