아니.. 너무 쉽자나.. (실행되는건 별개로)
$ pip install PyOpenGL PyOpenGL_accelerate Collecting PyOpenGL Downloading https://files.pythonhosted.org/packages/9c/1d/4544708aaa89f26c97cc09450bb333a23724a320923e74d73e028b3560f9/PyOpenGL-3.1.0.tar.gz (1.2MB) 100% |████████████████████████████████| 1.2MB 1.3MB/s Collecting PyOpenGL_accelerate Downloading https://files.pythonhosted.org/packages/d9/74/293aa8794f2f236186d19e61c5548160bfe159c996ba01ed9144c89ee8ee/PyOpenGL-accelerate-3.1.0.tar.gz (323kB) 100% |████████████████████████████████| 327kB 5.0MB/s Building wheels for collected packages: PyOpenGL, PyOpenGL-accelerate Running setup.py bdist_wheel for PyOpenGL ... done Stored in directory: /home/minimonk/.cache/pip/wheels/6c/00/7f/1dd736f380848720ad79a1a1de5272e0d3f79c15a42968fb58 Running setup.py bdist_wheel for PyOpenGL-accelerate ... done Stored in directory: /home/minimonk/.cache/pip/wheels/4e/8e/aa/ae3f1309ede1048b7f6a11c92d3d7d50fd6a7ab4507e6c7aca Successfully built PyOpenGL PyOpenGL-accelerate Installing collected packages: PyOpenGL, PyOpenGL-accelerate Successfully installed PyOpenGL-3.1.0 PyOpenGL-accelerate-3.1.0 |
$ pip install pyopengl numpy glfw Collecting pyopengl Collecting numpy Downloading https://files.pythonhosted.org/packages/e1/72/179a78b565ecf01fe98dab6417581d30acac15c2d93c49f93169ebea99b1/numpy-1.16.3-cp27-cp27mu-manylinux1_x86_64.whl (17.0MB) 100% |████████████████████████████████| 17.0MB 79kB/s Collecting glfw Downloading https://files.pythonhosted.org/packages/5d/65/c6275744a01425195f1f446e022e5dfa6497aa68479a3952e434e04b2fa0/glfw-1.7.1.tar.gz Building wheels for collected packages: glfw Running setup.py bdist_wheel for glfw ... done Stored in directory: /home/minimonk/.cache/pip/wheels/c5/53/f9/fd31798dce7e10aa49f8354e4111b9c9cad10c894184658663 Successfully built glfw Installing collected packages: pyopengl, numpy, glfw Successfully installed glfw-1.7.1 numpy-1.16.3 pyopengl-3.1.0 |
위에서 깔고깔고 하는데 라이브러리 없대서 또 깔고
ImportError: Failed to load GLFW3 shared library. $ sudo apt-get install libglfw3 |
근데 실행안되네 -_ㅠ
얘는 아마도.. 원격지에서 X11 forwarding 하려고 해서 그런거 같고
$ python pygl_test.py Traceback (most recent call last): File "pygl_test.py", line 92, in main() File "pygl_test.py", line 10, in main if not glfw.init(): File "/home/minimonk/.local/lib/python2.7/site-packages/glfw/__init__.py", line 607, in init res = _glfw.glfwInit() File "/home/minimonk/.local/lib/python2.7/site-packages/glfw/__init__.py", line 516, in errcheck _reraise(exc[1], exc[2]) File "/home/minimonk/.local/lib/python2.7/site-packages/glfw/__init__.py", line 50, in _reraise exec("raise exception, None, traceback") File "/home/minimonk/.local/lib/python2.7/site-packages/glfw/__init__.py", line 495, in callback_wrapper return func(*args, **kwargs) File "/home/minimonk/.local/lib/python2.7/site-packages/glfw/__init__.py", line 669, in _raise_glfw_errors_as_exceptions raise GLFWError(message) glfw.GLFWError: (65544) X11: RandR gamma ramp support seems broken |
흐음.. python2.7 이라서 3.7을 깔고 했는데 pip 설치 경로에 따라 다른건가? 3.7에서는 해당 모듈을 불러오질 못한다.
$ python3.7 pygl_test.py Traceback (most recent call last): File "pygl_test.py", line 1, in import glfw ModuleNotFoundError: No module named 'glfw' Error in sys.excepthook: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook from apport.fileutils import likely_packaged, get_recent_crashes File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in from apport.report import Report File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in import apport.fileutils File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in from apport.packaging_impl import impl as packaging File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in import apt File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in import apt_pkg ModuleNotFoundError: No module named 'apt_pkg' Original exception was: Traceback (most recent call last): File "pygl_test.py", line 1, in import glfw ModuleNotFoundError: No module named 'glfw' |
[링크 : https://github.com/totex/PyOpenGL_tutorials/blob/master/video_06_quad.py]
+
2019.05.04
ubuntu 깔고 native로 했는데 안된다.. ㅠㅠ GLSL3.30을 지원하지 않아서 라니 ㅠㅠ
$ python pygl.py No handlers could be found for logger "OpenGL.arrays.numpymodule" Traceback (most recent call last): File "pygl.py", line 92, in main() File "pygl.py", line 56, in main shader = OpenGL.GL.shaders.compileProgram(OpenGL.GL.shaders.compileShader(vertex_shader, GL_VERTEX_SHADER), File "/home/minimonk/.local/lib/python2.7/site-packages/OpenGL/GL/shaders.py", line 226, in compileShader shaderType, RuntimeError: ('Shader compile failure (0): 0:2(10): error: GLSL 3.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, and 3.00 ES\n', ['\n #version 330\n in vec3 position;\n in vec3 color;\n\n out vec3 newColor;\n void main()\n {\n gl_Position = vec4(position, 1.0f);\n newColor = color;\n }\n '], GL_VERTEX_SHADER) |
+
걍 속시원하게 2.7 밀고 새로 깔고 클린하게~
sudo apt-get remove python sudo apt-get remove python3.7 sudo apt-get autoremove sudo apt-get install python3.7 sudo apt-get install python3-pip |
[링크 : https://linuxize.com/post/how-to-install-python-3-7-on-ubuntu-18-04/]
[링크 : https://linuxize.com/post/how-to-install-pip-on-ubuntu-18.04/]
안되잖아! ㅠㅠ
$ python3 pygl_test.py Traceback (most recent call last): File "pygl_test.py", line 92, in main() File "pygl_test.py", line 10, in main if not glfw.init(): File "/home/minimonk/.local/lib/python3.6/site-packages/glfw/__init__.py", line 607, in init res = _glfw.glfwInit() File "/home/minimonk/.local/lib/python3.6/site-packages/glfw/__init__.py", line 516, in errcheck _reraise(exc[1], exc[2]) File "/home/minimonk/.local/lib/python3.6/site-packages/glfw/__init__.py", line 45, in _reraise raise exception.with_traceback(traceback) File "/home/minimonk/.local/lib/python3.6/site-packages/glfw/__init__.py", line 495, in callback_wrapper return func(*args, **kwargs) File "/home/minimonk/.local/lib/python3.6/site-packages/glfw/__init__.py", line 669, in _raise_glfw_errors_as_exceptions raise GLFWError(message) glfw.GLFWError: (65544) b'X11: RandR gamma ramp support seems broken' |
옛날 글이고 18.04 / python3에는 아래 패키지를 깔아주면 되는 듯.
$ sudo apt-get install python3-opengl |
Install the distribution package as: sudo apt-get install python-opengl - this works for me. |
[링크 : https://stackoverflow.com/questions/26700719/pyopengl-glutinit-nullfunctionerror]
일단은 해결~ 인가?
위에 쉐이더 쓰는건 원격으로 할 경우에는 방법이 없는 듯.. ㅠㅠ
[링크 : http://code.activestate.com/recipes/325391-open-a-glut-window-and-draw-a-sphere-using-pythono/]
'Programming > python(파이썬)' 카테고리의 다른 글
python pylint @ vscode (0) | 2019.05.09 |
---|---|
python wxpython (0) | 2019.05.08 |
python 3.7 + MS build tool 2015 + pyGL 또 실패 ㅠㅠ (0) | 2019.05.01 |
python + openGL (0) | 2019.04.30 |
python + openCV 공부 시작 (0) | 2019.04.30 |