且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

带有python&的Docker映像由于缺少编译器错误而导致高山故障

更新时间:2023-08-21 23:09:22

您需要一个可运行的编译器,解决此问题的最简单方法是像这样安装build-base软件包:

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

这将安装编译pynacl所需的各种工具,并且 pip install pynacl 现在将成功。

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

请注意,使用-virtual 标志是可选的,但是它可以轻松修剪图像,因为您可以运行 apk del .pynacl_deps 稍后在您的Dockerfile中使用,因为不再需要它们了,这会减小映像的整体大小。

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.