📝

PyOpenGLを上手くインストールできないときの対処法

2022/06/22に公開

背景

PyOpenGLをインストールしようとしたが、
「PyOpenGL ... .whl is not a supported wheel on this platform」
と表示され上手くできなかったので、メモ。

実行環境

  • Windows 11
  • Python 3.6
  • Anaconda

試したこと(上手くいかなかった)

  • 以下のコードを実行
     -> win32.pyファイルにfreeglutを入れたが駄目だった。
    pip install PyOpenGL
    pip install PyOpenGL_accelerate
    

解決方法

  1. Pythonのバージョン確認

    python --version
    
  2. 下記リンクにあるPyOpenGLの"PyOpenGL"と"PyOpenGL_accelerate"をダウンロード。
    ※このとき、Pythonのバージョンと同じファイルをダウンロードする。
     例)Python3.6 -> "cp36"のものを選ぶ

    https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyopengl

  3. .whlファイルのインストール
    ダウンロード先のパスへ移動後、以下実行

    pip install ダウンロードしたファイル
    

参考資料

https://qiita.com/emuai/items/1dd61ffa1b69643a9ca3
https://self-development.info/【python】pyopenglのインストール方法を解説/
https://stackoverflow.com/questions/61017582/pyopengl-3-1-5-cp36-cp36m-win-amd64-whl-is-not-a-supported-wheel-on-this-platfor

Discussion