[英]Docker image with python & alpine failure due missing compiler error
I'm looking for a docker image with both python3 and a crontab. 我正在寻找一个包含python3和crontab的docker镜像。 When I use
python:latest
as a base, I have no cron, but all required python packages install without problem. 当我使用
python:latest
作为基础时,我没有cron,但所有必需的python包安装没有问题。
When I use alpine as a base I have the (busybox) cron working, but are unable to install specific python package due to compiler error. 当我使用alpine作为基础时,我有(busybox)cron工作,但由于编译器错误而无法安装特定的python包。
The same applies when I use python:alpine
. 当我使用
python:alpine
时,同样适用python:alpine
。
Collecting pynacl>=1.0.1 (from paramiko->-r required_python_packages.txt (line 6))
Downloading PyNaCl-1.1.2.tar.gz (3.1MB)
Complete output from command python setup.py egg_info:
No working compiler found, or bogus compiler options
passed to the compiler from Python's distutils module.
See the error messages above.
Any advise? 有什么建议吗?
You need a working compiler, the easiest way around this is to install the build-base package like so: 你需要一个有效的编译器,最简单的方法就是安装build-base软件包,如下所示:
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. 这将安装编译pynacl和
pip install pynacl
所需的各种工具pip install pynacl
现在将成功。
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. 请注意,使用
--virtual
标志是可选的,但它可以轻松修剪图像,因为您可以稍后在Dockerfile中运行apk del .pynacl_deps
,因为它们不再需要,并且会减小图像的整体大小。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.