在Eclipse中为Python配置glfw [英] Configuring glfw for Python in Eclipse
问题描述
我正在尝试让OpenGL与Python一起使用.我正在使用glfw的python绑定来显示窗口/配置键盘等.
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.
pyglfw的 Sourceforge 页具有包含.pyd文件和dll的下载链接.在 git 页上,pyglfw包含一堆文件夹.
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.
我下载了这两个文件,并在Eclipse外部库"部分的Eclipse中使用PyDev对其进行了引用.我写了一些代码:
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");
并收到此错误
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
我不确定它无法运行什么.如果我在这些文件夹之一中引用了错误的目录,那么我需要在Eclipse的外部库中引用哪些目录以查找所需的目录?
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模块必须安装在正确的目录中.通常为$PYTHON/site-packages/…
.但是,为什么还要手动进行所有这些操作呢? pyglfw可通过PIP获得.
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
负责下载,构建和安装模块.
pip install pyglfw
takes care of downloading, building and installing the module.
这篇关于在Eclipse中为Python配置glfw的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!