尝试调用未定义的函数glutInit [英] Attempt to call an undefined function glutInit

查看:486
本文介绍了尝试调用未定义的函数glutInit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要python中的glut窗口. 我在使用Python 3.5和PyOpenGL.GLUT时遇到以下异常

I need a glut window in python. I have the following exception using Python 3.5 and PyOpenGL.GLUT

Traceback (most recent call last):
  File "D:\...\Test.py", line 47, in <module>

    if __name__ == '__main__': main()
  File "D:\...\Test.py", line 9, in main
    glutInit(sys.argv)
  File "C:\...\OpenGL\GLUT\special.py", line 333, in glutInit
    _base_glutInit( ctypes.byref(count), holder )
  File "C:\...\OpenGL\platform\baseplatform.py", line 407, in __call__
    self.__name__, self.__name__,

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

平台: Windows

为什么会出现此错误?

这是我的代码:

from OpenGL.GLUT import *
import sys

glutInit(sys.argv)

推荐答案

问题:

  • pip installeasy_install
  • 没问题
  • glut.dllglut32.dll丢失. (它们不是PyPI软件包的一部分),您必须单独安装它们或下载就像我一样.
  • There was no problem with pip install or easy_install
  • The glut.dll and glut32.dll were missing. (They are not part of the PyPI package) you have to install them separately or download it like I did.

glutdlls.zip解压缩dll文件并将其放置在我的python文件旁边.

Unzipped the dll files from the glutdlls.zip and placed them next to my python file.

注意:您可以将dll文件添加到您的PATH变量中.不必将它们保留在py文件旁边.

Note: You can add the dll files to your PATH variable. Not necessary to keep them next to the py file.

这篇关于尝试调用未定义的函数glutInit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆