본문 바로가기
파이썬 에러

ImportError: Could not import PIL.Image. The use of `load_img` requires PIL.

by 나는야석사 2024. 1. 3.

오류 메세지:

ImportError: Could not import PIL.Image. The use of `load_img` requires PIL.

 

test generator를 생성할 때 load_img를 사용하는데, 이는 PIL.Image에 속해있고 이를 쓰려면 PIL 라이브러리를 설치해야 한다.

따라서 pip나 conda 중 설치할 때 사용한 명령어를 이용해 pillow를 설치해주면 된다.

 

해결 방법:

pip install pillow