我正在尝试用这个Dockerfile安装seaborn
:
FROM alpine:latest
RUN apk add --update python py-pip python-dev
RUN pip install seaborn
CMD python
我得到的错误与numpy
和scipy
有关(seaborn
需要)。它的开头是:
/tmp/easy_install-nvj61E/numpy-1.11.1/setup.py:327: UserWarning:无法识别的setuptools命令,继续生成UserWarning源代码和展开模板
并以
get_mathlib_info文件"numpy/core/setup.py",第654行 RuntimeError:断掉的工具链:无法链接简单的C程序 命令"python setup.py egg_info“失败,错误代码1出现在/tmp/pip-build-DZ4cXr/scipy/ 命令'/bin/sh -c‘返回一个非零代码:1
知道我怎么能解决这个问题吗?
发布于 2016-07-25 07:05:43
要修复此错误,需要安装gcc
:apk add gcc
。
但是您将看到您将遇到一个新的错误,因为numpy、matplotlip和hit有几个依赖项。您还需要安装gfortran
、musl-dev
、freetype-dev
等。
下面是一个基于初始文件的Dockerfile,它将安装这些依赖项以及seaborn
:
FROM alpine:latest
# install dependencies
# the lapack package is only in the community repository
RUN echo "http://dl-4.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
RUN apk --update add --no-cache \
lapack-dev \
gcc \
freetype-dev
RUN apk add python py-pip python-dev
# Install dependencies
RUN apk add --no-cache --virtual .build-deps \
gfortran \
musl-dev \
g++
RUN ln -s /usr/include/locale.h /usr/include/xlocale.h
RUN pip install seaborn
# removing dependencies
RUN apk del .build-deps
CMD python
您会注意到,我正在使用apk-del .build-deps
删除依赖项,以限制图像(http://www.sandtable.com/reduce-docker-image-sizes-using-alpine/)的大小。
就我个人而言,我也必须安装ca证书,但似乎您没有这个问题。
注意:您也可以从python:2.7-alpine
映像构建映像,以避免自己安装python。
https://stackoverflow.com/questions/38568476
复制相似问题