“The headers or library files could not be found for jpeg” installing Pillow on Alpine Linux

后端 未结 10 1535
闹比i
闹比i 2021-02-01 12:33

I\'m trying to run Python\'s Scrapy in a Docker container based on python:alpine. It was working before, but now I\'d like to use Scrapy\'s Image Pipeline which requires me to i

10条回答
  •  礼貌的吻别
    2021-02-01 13:01

    In a comment that appears to have been deleted later, someone pointed me to https://github.com/python-pillow/Pillow/blob/c05099f45c0d94a2a98c3609a96bdb6cf7446627/depends/alpine_Dockerfile. Based on that Dockerfile I modified my own as follows:

    FROM python:alpine
    RUN apk --update add libxml2-dev libxslt-dev libffi-dev gcc musl-dev libgcc openssl-dev curl
    RUN apk add jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev
    RUN pip install Pillow
    

    Now it builds successfully.

提交回复
热议问题