티스토리 뷰

반응형

Stack Overflow에 자주 검색, 등록되는 문제들과 제가 개발 중 찾아 본 문제들 중에서 나중에도 찾아 볼 것 같은 문제들을 정리하고 있습니다.

Stack Overflow에서 가장 먼저 확인하게 되는 가장 높은 점수를 받은 Solution과 현 시점에 도움이 될 수 있는 가장 최근에 업데이트(최소 점수 확보)된 Solution을 각각 정리하였습니다.

 

아래 word cloud를 통해 이번 포스팅의 주요 키워드를 미리 확인하세요.

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

ImportError: libGL.so.1: 공유 개체 파일을 열 수 없습니다. 해당 파일 또는 디렉토리가 없습니다.

 문제 내용 

I am trying to run cv2, but when I try to import it, I get the following error:

cv2를 실행하려고 하는데 가져오려고 하면 다음 오류가 발생합니다.

 

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

The suggested solution online is installing

온라인에서 제안된 솔루션은 설치 중입니다.

 

apt install libgl1-mesa-glx

but this is already installed and the latest version.

그러나 이 버전은 이미 설치되어 있고 최신 버전입니다.

 

NB: I am actually running this on Docker, and I am not able to check the OpenCV version. I tried importing matplotlib and that imports fine.

NB: 실제로 Docker에서 실행하고 있는데 OpenCV 버전을 확인할 수 없습니다. 나는 matplotlib를 수입하려고 시도했고 그것은 잘 수입된다.

 

 

 

 높은 점수를 받은 Solution 

Add the following lines to your Dockerfile:

Docker 파일에 다음 줄을 추가합니다.

 

RUN apt-get update
RUN apt-get install ffmpeg libsm6 libxext6  -y

These commands install the cv2 dependencies that are normally present on the local machine, but might be missing in your Docker container causing the issue.

이러한 명령은 일반적으로 로컬 시스템에 있지만 문제의 원인이 되는 Docker 컨테이너에 없을 수 있는 cv2 종속성을 설치합니다.

 

 

 

 가장 최근 달린 Solution 

If you're on CentOS, RHEL, Fedora, or other linux distros that use yum, you'll want:

CentOS, RHEL, Fedora 또는 yum을 사용하는 기타 Linux 디스트로스를 사용하는 경우 다음을 원할 것입니다.

 

sudo yum install mesa-libGL -y

 

 

출처 : https://stackoverflow.com/questions/55313610/importerror-libgl-so-1-cannot-open-shared-object-file-no-such-file-or-directo

반응형
댓글
공지사항
최근에 올라온 글