【问题标题】:PyOpenGL-3.1.5-cp36-cp36m-win_amd64.whl is not a supported wheel on this platformPyOpenGL-3.1.5-cp36-cp36m-win_amd64.whl 不是该平台支持的轮子
【发布时间】:2020-09-16 16:30:33
【问题描述】:

对于 Python 项目,我需要 PyOpenGL。我已经用 PyCharm IDE 安装了它。

当我运行 OpenGL 程序测试安装时,出现以下错误消息:

OpenGL.error.NullFunctionError: Attempt to call an undefined function glutInit, check for bool(glutInit) before calling.

我在 www 中搜索了可能的解决方案,并在 StackOverflow 找到了一些解决方案。我尝试了所有这些,但都没有奏效。

然后我在这里找到了那个博客:

https://block.arch.ethz.ch/blog/2016/10/pyopengl-glut-error/

我按照所有说明操作并在 PyCharm IDE 中收到以下错误消息:

(virtual-environment) C:\Users\Rainer\PycharmProjects\MatchMover>pip install C:\Users\Rainer\Desktop\PyOpenGL-3.1.5-cp36-cp36m-win_amd64.whl
PyOpenGL-3.1.5-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform.
You are using pip version 9.0.1, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

pip 包已经手动更新到 20.0.2 版本,但与 PyCharm IDE 不同步。

我使用的是 Windows 7 计算机、Python 3.6.3PyOpenGL-3.1.5-cp36-cp36m-win_amd64.whl 作为 OpenGL 库,我使用 freeglut

这里是测试程序(取自:https://codeloop.org/python-opengl-programming-creating-window/):

ma​​in.py

from OpenGL.GL import *
from OpenGL.GLUT import *

width, height = 500, 400 

def draw():
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
    glLoadIdentity()

    glutSwapBuffers()


glutInit()
glutInitDisplayMode(GLUT_RGBA )
glutInitWindowSize(width, height)
glutInitWindowPosition(200, 200)
window = glutCreateWindow("Opengl Window In Python")
glutDisplayFunc(draw)
glutIdleFunc(draw)
glutMainLoop()

【问题讨论】:

  • "PyOpenGL-3.1.5-cp36-cp36m-win_amd64.whl 不是该平台支持的轮子。" 表示您的 Python 是 3.6 或不是 64 -bit(不是 amd64)。也许你的 Python 是 32 位的。使用 32 位轮子或安装 64 位 Python。
  • import sys, print(sys.executable) 应该显示真正使用的版本。也可以试试print(sys.version)print(sys.version_info)
  • 我的猜测是您正在使用您希望使用的 Python 解释器进行 npt。修复环境变量PATH
  • @phd 非常感谢您的帮助!我能够安装 PyOpenGL 而没有任何错误!我的 Python 是 32 位的。我已经安装了 32 位的轮子。测试程序也能正常运行!
  • @joe 也感谢您的帮助!

标签: python opengl pip pyopengl


【解决方案1】:

此错误的两个常见来源是……

  1. 软件包需要不同的系统类型(32 位与 64 位)。
  2. 系统没有或无法识别必要的 Python 版本,即有人只安装了 3.x 版本,但软件包需要 Python 2.7。

但正如你所说,你有 python 3.6,所以我会为第一个选项提供解决方案。

解决方法是下载其他版本(如果您下载的是 64 位,则为 32 位,反之亦然),或者如果您知道您需要您拥有的版本,请更改轮盘的文件名。

【讨论】:

  • 非常感谢您的回答。我的问题已经解决了(见上面的 cmets)。
猜你喜欢
  • 1970-01-01
  • 2019-12-28
  • 2017-09-20
  • 2020-04-05
  • 2022-12-01
  • 2020-07-18
  • 2019-10-22
  • 2020-12-25
  • 2020-04-23
相关资源
最近更新 更多