2013-06-30 24 views
0

我試圖讓OpenGL與Python一起工作。我正在使用glfw的python綁定來顯示窗口/配置鍵盤等。在Eclipse中爲Python配置glfw

pyglfw的Sourceforge頁面有一個包含.pyd文件和dll的下載鏈接。在git頁面上,pyglfw包含一堆文件夾。

我下載了這兩個,並在Eclipse的「外部庫」部分中使用Eclipse中的PyDev引用它們。我寫了一些代碼:

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的外部庫中引用哪些內容才能找到它需要的內容?

回答

0

Python模塊必須安裝在正確的目錄中。通常$PYTHON/site-packages/…。然而,爲什麼要麻煩手動完成所有這些。 pyglfw可通過PIP獲得。

pip install pyglfw負責下載,構建和安裝模塊。