我为python3安装了PyOpenGl,当我导入包时,我得到了值错误

时间:2013-02-20 15:00:42

标签: python macos install pyopengl

我想从一些PyOpenGL开始,所以我启动进入Mac Osx尝试它。我去了PyOpenGl网站,下载了PyOpenGl和PyOpenGl_accelerate tars,cd进了我的下载目录,然后在终端输入这些命令进行安装:

tar -zxvf PyOpenGL-3.0.2.tar.gz
cd PyOpenGL-3.0.2
python3 setup.py install #I changed 'python' to 'python3' to install it to my python3. 

接下来,我输入了这些来安装加速包

tar -zxvf PyOpenGL-accelerate-3.0.2.tar.gz
cd PyOpenGL-accelerate-3.0.2
python3 setup.py install #Again, 'python' replaced with 'python3'

最后,我运行此代码来测试安装

python3
>>>from OpenGL.GL import *

给了我这一串可爱的错误

    Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/PyOpenGL-3.0.2-py3.3.egg/OpenGL/GL/__init__.py", line 3, in <module>
    from OpenGL.GL.VERSION.GL_1_1 import *
  File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/PyOpenGL-3.0.2-py3.3.egg/OpenGL/GL/VERSION/GL_1_1.py", line 10, in <module>
    from OpenGL import platform, constants, constant, arrays
  File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/PyOpenGL-3.0.2-py3.3.egg/OpenGL/arrays/__init__.py", line 19, in <module>
    from OpenGL.arrays.arraydatatype import *
  File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/PyOpenGL-3.0.2-py3.3.egg/OpenGL/arrays/arraydatatype.py", line 14, in <module>
    from OpenGL_accelerate.arraydatatype import ArrayDatatype as ADT
  File "arraydatatype.pyx", line 1, in init OpenGL_accelerate.arraydatatype (src/arraydatatype.c:9315)
  File "wrapper.pyx", line 2, in init OpenGL_accelerate.wrapper (src/wrapper.c:10792)
ValueError: level must be >= 0

知道为什么会这样表现吗?

编辑:使用以下命令设法让pyopengl为python3工作:

sudo pip-3.3 install PyOpenGL

所以...问题解决了我猜...

1 个答案:

答案 0 :(得分:7)

在这里回答我自己的问题,我设法让PyOpenGL使用命令

sudo pip-3.3 install PyOpenGl