1

我最近安装了 pythonxy 并尝试运行以(在 Eclipse 中)开头的代码:

from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *

并得到

from OpenGL.GL import *
ImportError: No module named GL

我卸载了pythonxy,安装了完整版的EPD和同样的错误......

sys.path 给了我:

['D:\\eclipse-java-indigo-SR2-   win32\\eclipse\\plugins\\org.python.pydev_2.7.1.2012100913\\pysrc',
'C:\\Users\\Kuba\\workspace\\python\\ThinkPython\\src',
'C:\\Python27\\lib\\site-packages\\pyopengl-3.0.2-py2.7-win32.egg',
'C:\\Python27\\python27.zip',
'C:\\Python27\\DLLs',
'C:\\Python27\\lib',
'C:\\Python27\\lib\\plat-win',
'C:\\Python27\\lib\\lib-tk',
'C:\\Python27',
'C:\\Python27\\lib\\site-packages',
'C:\\Python27\\lib\\site-packages\\PIL',
'C:\\Python27\\lib\\site-packages\\win32',
'C:\\Python27\\lib\\site-packages\\win32\\lib',
'C:\\Python27\\lib\\site-packages\\Pythonwin',
'C:\\Python27\\lib\\site-packages\\IPython\\extensions']

如您所见 - 我正在使用 Windows 机器。

我在这里看到了类似的问题,但没有任何帮助......

我是 python 新手 - 也许解决方案很简单......

有什么建议么 ?

问候

4

2 回答 2

2

You have an installation issue with your PyOpenGL module. Older versions of EPD (pre 6.2-1) had an issue with the 64bit PyOpenGL package - you may need to update EPD.

Alternatively, you could try to install through easy_install

C:\Python27\scripts\easy_install pyopengl

or pip

C:\Python27\scripts\pip pyopengl

or using the binaries on Christoph Gohlke's site.

Personally I'd recommend installing Chris' binaries - they've always worked well for me.

于 2013-02-26T12:28:42.403 回答
1

对于文件名是 OpenGL.py,我得到了同样的错误。如果您的文件名相同,请尝试重命名它。

于 2013-06-12T11:57:18.117 回答