I'm trying to get OpenGL to work with Python. I'm using a python binding of glfw to display the window/configure the keyboard and such.
The Sourceforge page for pyglfw has a download link containing a .pyd file and a dll. On the git page, pyglfw contains a bunch of folders.
I downloaded both, and referenced them with PyDev in Eclipse, in the Eclipse "External Libraries" section. I wrote some code:
import glfw
glfw.Init();
if (glfw.OpenWindow(800, 600, 5, 6, 5, 0, 8, 0, glfw.FULLSCREEN) != True):
glfw.Terminate(); # calls glfwTerminate() and exits
glfw.SetWindowTitle("The GLFW Window");
And received this error
Traceback (most recent call last):
File "C:\Users\Zolani\workspace\PyGLCanvas\main\main.py", line 1, in
import glfw
File "C:\Users\Zolani\Desktop\pyglfw-main\pyglfw-master\glfw\__init__.py", line 395, in
raise RuntimeError("no GLFW shared library found")
RuntimeError: no GLFW shared library found
I'm not sure what it's unable to find that it won't run. If I'm referencing the wrong directories within one of these folders, which ones do I need to reference in Eclipse's external library for it to find what it needs?
解决方案
Python modules must be installed in the right directories. Usually $PYTHON/site-packages/…. However why bother with doing all this manually. pyglfw is available through PIP.
pip install pyglfw takes care of downloading, building and installing the module.