2013-02-20 90 views
2

我想從一些PyOpenGL開始,因此我啓動進入Mac Osx嘗試它。我去PyOpenGl網站上,下載的PyOpenGl和PyOpenGl_accelerate焦油,cd'd到我的下載目錄,和類型化這些命令到終端安裝:我爲Python3安裝了PyOpenGl,當我導入軟件包時,出現值錯誤

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 

所以......問題就解決了我猜...

+0

我可以請您回答您自己的問題並將其標記爲已接受,而不是將解決方案放在問題的內部?謝謝。 – Kev 2013-02-26 13:48:44

回答

7

回答我的問題在這裏,我設法PyOpenGL使用命令

sudo pip-3.3 install PyOpenGl