1

Encountered the following error:

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

Wrong tutorial: 👉 Install opencv in docker environment ImportError: libGL.so.1: cannot open shared object file: No such file or directory
🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡
图片.png

Correct tutorial:👇

FROM python:3.9-buster
RUN (apt-get update) && (apt-get install -y libgl1-mesa-dev ffmpeg libsm6 libxext6)
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
COPY requirements.txt /code/
RUN (/usr/local/bin/python -m pip install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple) && (pip install -i https://mirrors.aliyun.com/pypi/simple -r requirements.txt)
COPY . /code/

Just install these four things: libgl1-mesa-dev , ffmpeg , libsm6 , libxext6

Don't change opencv-python to opencv-python-headless , this is a very brainless practice

universe_king
3.4k 声望680 粉丝