3

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

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

4

1 回答 1

7

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

sudo pip-3.3 install PyOpenGl
于 2013-02-26T20:01:15.773 回答