본문 바로가기

기타

[python] ModuleNotFoundError: No module named 'PIL'

728x90

python ModuleNotFoundError: No module named 'PIL'

테스트 환경

$ sw_vers
ProductName:	macOS
ProductVersion:	12.5
BuildVersion:	21G72


$ python --version
Python 3.9.13

Module Not Found Error

Traceback (most recent call last):
  File "/Users/.../convert_image.py", line 2, in <module>
    from PIL import Image
ModuleNotFoundError: No module named 'PIL'

pillow(PIL) 모듈 설치

pip 명령을 사용하여 pillow(PIL) 모듈 설치

pip3 install Pillow
$ pip3 install Pillow
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Collecting Pillow
  Downloading Pillow-9.2.0-cp39-cp39-macosx_11_0_arm64.whl (2.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.8/2.8 MB 29.9 MB/s eta 0:00:00
Installing collected packages: Pillow
  DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Successfully installed Pillow-9.2.0
$ pip3 list | egrep -i pillow
Pillow             9.2.0

 

728x90