乐趣区

关于docker:docker-打包-opencv报错解决方法

遇到上面的谬误:

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

谬误的教程:docker 环境里装置 opencv ImportError: libGL.so.1: cannot open shared object file: No such file or directory

正确的教程:

FROM python:3.9-buster
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
COPY requirements.txt /code/
RUN (apt-get update) && (apt-get install -y libgl1-mesa-dev ffmpeg libsm6 libxext6)
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/

装置这四个货色就好了:libgl1-mesa-dev ffmpeg libsm6 libxext6

不要把 opencv-python 改为 opencv-python-headless

退出移动版