在 Docker Alpine 上安装 numpy [英] Installing numpy on Docker Alpine

查看:83
本文介绍了在 Docker Alpine 上安装 numpy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在基于 Alpine 3.1 的 docker 容器中安装 numpy.我正在使用以下 Dockerfile:

I'm trying to install numpy in a docker container based on Alpine 3.1. I'm using the following Dockerfile:

FROM alpine:3.1
RUN apk add --update make cmake gcc g++ gfortran
RUN apk add --update python py-pip python-dev
RUN pip install cython
RUN pip install numpy

这运行良好,直到 pip install numpy 出现以下错误:

This runs fine until pip install numpy when I get the following error:

error: Command "gcc -fno-strict-aliasing -Os -fomit-frame-pointer -DNDEBUG -Os -fomit-frame-pointer -fPIC -Inumpy/core/include -Ibuild/src.linux-x86_64-2.7/numpy/core/include/numpy -Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/include/python2.7 -Ibuild/src.linux-x86_64-2.7/numpy/core/src/private -Ibuild/src.linux-x86_64-2.7/numpy/core/src/private -Ibuild/src.linux-x86_64-2.7/numpy/core/src/private -c build/src.linux-x86_64-2.7/numpy/core/src/npymath/ieee754.c -o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/numpy/core/src/npymath/ieee754.o" failed with exit status 1

easy_install-2.7 numpy 给出同样的错误.

是否有我遗漏的任何配置/安装步骤?

Are there any config/installation steps I'm missing?

推荐答案

如果你不需要从 pypi 安装 numpy,你可以从 alpine 安装存储库.包名为 py-numpy 并位于 testing 存储库中,请参阅 此处.对我有用的最小 Dockerfile 示例

If you don't necessary need to install numpy from pypi, you could install it from alpine repositories. Package is named py-numpy and is in testing repository, see here. Minimal Dockerfile example that works for me

FROM alpine:3.2
ADD repositories /etc/apk/repositories
RUN apk add --update python python-dev gfortran py-pip build-base py-numpy@community

repositories 文件的内容

http://dl-cdn.alpinelinux.org/alpine/v3.2/main
@community http://dl-cdn.alpinelinux.org/alpine/edge/community

这篇关于在 Docker Alpine 上安装 numpy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆