尝试在容器上运行 openCV/pillow 时,为什么会出现此错误?

问题描述

我有一个可以在本地执行但不能在 docker 容器中执行的程序。运行时

image=cv2.imread(input_file_path)

我明白了:

libpng warning: Duplicate iCCP chunk

程序在几秒钟后终止。如果我尝试安装 Pillow 6.1.0(与我在本地安装的版本相同),则在尝试执行 docker build 时会出现此错误

  The headers or library files Could not be found for jpeg,a required dependency when compiling Pillow from source.
  
  Please see the install instructions at:
     https://pillow.readthedocs.io/en/latest/installation.html

但一直无法解决问题。

需求.txt:

boto3==1.14.46
imutils==0.5.4
opencv-python==4.5.1.48
urllib3==1.25.10

Dockerfile:

FROM continuumio/miniconda3

copY . /
workdir /
RUN pip install --upgrade pip setuptools wheel
ADD requirements.txt /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt && rm /tmp/requirements.txt
RUN pip install Pillow
RUN apt-get update
RUN apt-get install ffmpeg libsm6 libxext6  -y
ENTRYPOINT ["python","main.py"]

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)