相关疑难解决方法(0)

在Docker Alpine上安装numpy

我正在尝试在基于Alpine 3.1的docker容器中安装numpy.我正在使用以下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
Run Code Online (Sandbox Code Playgroud)

这运行正常,直到pip install numpy我收到以下错误:

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
Run Code Online (Sandbox Code Playgroud)

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

我缺少任何配置/安装步骤吗?

python numpy pip docker alpine-linux

24
推荐指数
5
解决办法
3万
查看次数

构建 docker 镜像时无法安装 sklearn

当我在构建 docker 映像时尝试安装 sklearn (scikit-learn) 时,它失败了。

这些是 Dockerfile 的已处理行:

FROM amancevice/pandas:0.25.0-alpine

RUN apk update
RUN apk add build-base
RUN apk add gcc musl-dev libc-dev util-linux-dev linux-headers python3-dev postgresql-libs postgresql-dev git libffi-dev libmemcached-dev zlib-dev ca-certificates zlib-dev jpeg-dev freetype-dev libpng

RUN pip3 install --upgrade pip
RUN pip3 install scikit-learn
Run Code Online (Sandbox Code Playgroud)

一切都很顺利,直到最后一行。在那里,它首先需要很长时间,然后就会发生错误。这是日志:

Step 6/13 : RUN pip3 install scikit-learn
 ---> Running in 154f28d1d6db
Collecting scikit-learn
  Downloading scikit-learn-0.23.1.tar.gz (7.2 MB)
  Installing build dependencies: started
  Installing build dependencies: still running...
  Installing build dependencies: still running...
  Installing …
Run Code Online (Sandbox Code Playgroud)

python scikit-learn docker dockerfile

6
推荐指数
1
解决办法
4676
查看次数

标签 统计

docker ×2

python ×2

alpine-linux ×1

dockerfile ×1

numpy ×1

pip ×1

scikit-learn ×1