Fra*_*ani 12 python opengl pyopengl visual-c++ visual-studio-2017-build-tools
我正在遵循这个非常简单的指南,以便迈出进入 PyOpenGL 的第一步。
\n我安装了pip install PyOpenGL PyOpenGL_accelerate,一切都好。
我通过测试代码测试了安装:
\nimport OpenGL.GL\nimport OpenGL.GLUT\nimport OpenGL.GLU\nprint("导入成功!") # 如果您看到此信息打印到控制台,则安装成功
\n都好
\n我现在运行这个脚本:
\nfrom OpenGL.GL import *\nfrom OpenGL.GLUT import *\nfrom OpenGL.GLU import *\n\nw,h= 500,500\ndef square():\n glBegin(GL_QUADS)\n glVertex2f(100, 100)\n glVertex2f(200, 100)\n glVertex2f(200, 200)\n glVertex2f(100, 200)\n glEnd()\n\ndef iterate():\n glViewport(0, 0, 500, 500)\n glMatrixMode(GL_PROJECTION)\n glLoadIdentity()\n glOrtho(0.0, 500, 0.0, 500, 0.0, 1.0)\n glMatrixMode (GL_MODELVIEW)\n glLoadIdentity()\n\ndef showScreen():\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)\n glLoadIdentity()\n iterate()\n glColor3f(1.0, 0.0, 3.0)\n square()\n glutSwapBuffers()\n\nglutInit()\nglutInitDisplayMode(GLUT_RGBA)\nglutInitWindowSize(500, 500)\nglutInitWindowPosition(0, 0)\nwind = glutCreateWindow("OpenGL Coding Practice")\nglutDisplayFunc(showScreen)\nglutIdleFunc(showScreen)\nglutMainLoop()\nRun Code Online (Sandbox Code Playgroud)\n我收到的错误是OpenGL.error.NullFunctionError: Attempt to call an undefined function glutInit, check for bool(glutInit) before calling
所以我在网上阅读了一些指南,他们指出从这里下载轮子。所以我继续下载PyOpenGL_accelerate\xe2\x80\x913.1.5\xe2\x80\x91cp38\xe2\x80\x91cp38\xe2\x80\x91win_amd64.whl,PyOpenGL\xe2\x80\x913.1.5\xe2\x80\x91cp38\xe2\x80\x91cp38\xe2\x80\x91win_amd64.whl因为我正在跑步Python 3.8
pip install .\\PyOpenGL_accelerate-3.1.5-cp39-cp39-win_amd64.whl回报PyOpenGL-accelerate is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.pip install .\\PyOpenGL_accelerate-3.1.5-cp38-cp38-win_amd64.whl回报PyOpenGL-accelerate is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.如此简单的指南怎么会导致我如此痛苦的结果呢?
\n如何检查是否Visual C++ 14.0 build tools已安装。也许这是我唯一缺少的一步?
Rab*_*d76 16
由于“Python 扩展包的非官方 Windows 二进制文件”不再存在(请参阅Christoph Gohlke 的 Windows Wheels 站点将于月底关闭),以下解决方案不再有效:
\n卸载“PyOpenGL”:
\npip uninstall pyopengl\nRun Code Online (Sandbox Code Playgroud)\n从Python 扩展包的非官方 Windows 二进制文件下载包轮(例如:“PyOpenGL\xe2\x80\x913.1.6\xe2\x80\x91cp311\xe2\x80\x91cp311\xe2\x80\x91win_amd64.whl”)并安装它:
\npip install PyOpenGL\xe2\x80\x913.1.6\xe2\x80\x91cp311\xe2\x80\x91cp311\xe2\x80\x91win_amd64.whl\nRun Code Online (Sandbox Code Playgroud)\n \n或者,可以在这里找到轮子:https://drive.google.com/drive/folders/1mz7faVsrp0e6IKCQh8MyZh-BcCqEGPwx
\n如果您找不到满足您需求的轮子,则需要克隆mcfletch/pyopengl存储库并从存储库安装 PyOpenGL(另请参阅PyOpenGL 和 PyOpenGL_Accelerate):
\n克隆存储库:
\ngit clone https://github.com/mcfletch/pyopengl\nRun Code Online (Sandbox Code Playgroud)\n安装pyopengl和pyopengl_accelerate:
\ncd pyopengl\npip install -e .\ncd accelerate\npip install -e .\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
19996 次 |
| 最近记录: |