【ImportError】cannot import name ‘PILLOW_VERSION’ を解決する方法【Solved】

スポンサーリンク

【ImportError】cannot import name ‘PILLOW_VERSION’ を解決する方法【Solved】

Pythonのプログラムを実行時に、以下のようなPillowに関するエラーが出てきた。

from PIL import Image, ImageOps, ImageEnhance, PILLOW_VERSION
ImportError: cannot import name 'PILLOW_VERSION' from 'PIL' (/home/masaki/.local/lib/python3.7/site-packages/PIL/__init__.py)

この問題の解決方法を見つけたのでまとめておく。

【解決法】Pillowのバージョンを6.1に下げる

バージョンを下げれば良いことが分かった。エラーが出ているときのバージョンは9.1だったので高すぎたようだ。

Pillowのバージョンは以下のコマンドで下げることができる。
ここではバージョン6.1を指定。

python3 -m pip install --upgrade Pillow=6.1

参考:https://github.com/python-pillow/Pillow/issues/4130

人気記事

人気記事はこちら。

CUDA、cuDNNのバージョンをターミナルで調べるコマンド
【Pytorch】テンソルを連結する方法(cat・stack)
【Pytorch】テンソルの次元を追加・削除する方法【dim】
【Protobuf】"TypeError: Descriptors cannot not be created directly."を解決する【solved】
【Python】Tensorflowをダウングレード・アップグレードするコマンド
タイトルとURLをコピーしました