0

I am trying to run a python script on my mac .I am getting the error :-

ImportError: No module named opengl.opengl

I googled a bit and found that I was missing pyopengl .I installed pip.I go to the directory pip-1.0 and then say

sudo pip install pyopengl

and it installs correctly I believe because I got this

Successfully installed pyopengl Cleaning up...

at the end. I rerun the script but i am still getting the same error .Can someone tell me what I might be missing? Thanks!

Manish
  • 1,729
  • 5
  • 32
  • 47
  • How are you importing your module? `import opengl.opengl`? I've never used OpenGL, but it looks like the import is `from OpenGL.GL import *`. Is this a script you wrote or one you're using from somewhere else? – RocketDonkey Oct 06 '12 at 01:31
  • @RocketDonkey: Yes the import is something like "from ..opengl.opengl import *".What should i use instead of this ? – Manish Oct 08 '12 at 22:23
  • 1
    You could perhaps try `from OpenGL.GL import *` instead, but again, I've never used it so I could be way off :) – RocketDonkey Oct 08 '12 at 23:10

2 Answers2

1

Is it in the PYTHON-PATH? Maybe try something like this:

import sys  
sys.path.append(opengl-dir)  
import opengl.opengl

Replace the opengl-dir with the directory that you have installed in... Maybe try what RocketDonkey is suggesting... I don't know, really...

Antoni4040
  • 2,297
  • 11
  • 44
  • 56
  • I changed my .bash_profile to include "export PYTHONPATH=$PYTHONPATH:/Library/Python/2.7/site-packages" .There is a directory by name "OpenGL" and "PyOpenGL-3.0.2.blahblah.egg-info" under that path "/Library/Python/2.7/site-packages" .This is what you meant right? FYI it doesnt work though – Manish Oct 08 '12 at 22:49
0

Thanks guys! I figured it out.It was infact a separate module which I needed to copy over to the "site-packages" location and it worked fine.So in summary no issues with the path just that the appropriate module was not there.

Manish
  • 1,729
  • 5
  • 32
  • 47