Docker image with python & alpine failure due missing compiler error

前端 未结 1 2222
旧时难觅i
旧时难觅i 2021-02-20 18:29

I\'m looking for a docker image with both python3 and a crontab. When I use python:latest as a base, I have no cron, but all required python packages install withou

1条回答
  •  礼貌的吻别
    2021-02-20 19:12

    You need a working compiler, the easiest way around this is to install the build-base package like so:

    apk add --no-cache --virtual .pynacl_deps build-base python3-dev libffi-dev
    

    This will install various tools that are required to compile pynacl and pip install pynacl will now succeed.

    Note it is optional to use the --virtual flag but it makes it easy to trim the image because you can run apk del .pynacl_deps later in your Dockerfile as they are not needed any more and would reduce the overall size of the image.

    0 讨论(0)
提交回复
热议问题