我想从一些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

所以问题解决了我想…

最佳答案

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

sudo pip-3.3 install PyOpenGl

07-24 22:32