새소식

ETC/오류 해결 - 2023.05.13

Docker 환경에서 ImportError: libGL.so.1: cannot open shared object file: No such file or directory 발생 시 해결 방법

  • -

문제 상황


opencv를 포함한 Docker 이미지를 만들 때 cv2의 의존 패키지가 없을 때 발생한다.

 

해결 방법


의존 패키지를 추가로 설치하거나 opencv-python-headless과 같이 애초에 서버용으로 제작된 라이브러리를 활용하자.

  • opencv-python-headless 사용하기
RUN pip3 install opencv-python-headless
  • 의존 패키지 직접 설치하기
RUN apt-get update && apt-get install libgl1-mesa-glx -y
RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y

참고

 

ImportError: libGL.so.1: cannot open shared object file: No such file or directory

I am trying to run cv2, but when I try to import it, I get the following error: ImportError: libGL.so.1: cannot open shared object file: No such file or directory The suggested solution online is

stackoverflow.com

 

Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.