Configuring glfw for Python in Eclipse

心已入冬 提交于 2019-12-12 00:28:26

问题


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 <module>
    import glfw 
  File "C:\Users\Zolani\Desktop\pyglfw-main\pyglfw-master\glfw\__init__.py", line 395,     in <module>
    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?


回答1:


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.



来源:https://stackoverflow.com/questions/17388311/configuring-glfw-for-python-in-eclipse

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!