PyOpenGL is not work - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: PyOpenGL is not work (/thread-40325.html) |
PyOpenGL is not work - PoseidonLin - Jul-11-2023 Terminal input: pip install pyopengl pip install pyopengl_accelerate Code: import OpenGL.GL import OpenGL.GLUT import OpenGL.GLUError:
RE: PyOpenGL is not work - Axel_Erfurt - Jul-11-2023 Did you name your file OpenGL.py? RE: PyOpenGL is not work - PoseidonLin - Jul-12-2023 (Jul-11-2023, 11:37 AM)Axel_Erfurt Wrote: Did you name your file OpenGL.py?yes RE: PyOpenGL is not work - deanhystad - Jul-12-2023 Do you know that naming your file OpenGL.py is bad and the cause of your error? RE: PyOpenGL is not work - PoseidonLin - Jul-12-2023 (Jul-12-2023, 03:06 AM)deanhystad Wrote: Do you know that naming your file OpenGL.py is bad and the cause of your error?so i importing opengl but machine think i mean import opengl.py? RE: PyOpenGL is not work - deanhystad - Jul-12-2023 When Python executes this in your program: import OpenGL.GLIt searches the python path for "OpenGL.py". This should be found in a folder that was added to your "python311/Lib/site-packages" (or whatever version of Python or whatever virtual environment you are using) folder when you ran pip install. But before it looks in "python311/Lib/site-packages" in looks for the OpenGL.py in the current working directory, usually the same directory as the program you are running. If it finds the file there, it imports that file, not the package you installed using pip. If you want to use OpenGL, you should not create any files named OpenGL.py. You can use "Open_GL.py" or "opengl_test.py" or any name that does not match the name of modules you import in your program. |