在docker中从源代码构建numpy

时间:2017-08-01 13:45:29

标签: python-3.x numpy docker

大家好我想在docker容器中从源代码构建numpy。 这是我的Dockerfile:

FROM debian:testing
MAINTAINER Dr Suman Khanal <suman81765@gmail.com>
LABEL updated_at '2017-07-26'
WORKDIR /
RUN apt-get update \
&& apt-get install -y gnupg git wget build-essential python3 python3-dev 
python3-setuptools python3-pip libatlas3-base libatlas-dev libatlas-base-dev 
liblapack-dev libblas-common libblas3 libblas-dev cython

RUN git clone https://github.com/numpy/numpy.git
WORKDIR /numpy
RUN python3 setup.py build --fcompiler=gnu95 install 
CMD ["numpy"]

但它抛出了这个错误。 Build failed: The command '/bin/sh -c python3 setup.py build --fcompiler=gnu95 install' returned a non-zero code: 1 有什么帮助吗?

非常感谢,

苏曼

1 个答案:

答案 0 :(得分:0)

这是Dockerfile

FROM debian:testing

MAINTAINER Dr Suman Khanal <suman81765@gmail.com>
LABEL updated_at '2017-07-26'

WORKDIR /
RUN apt-get update \
 && apt-get install -y gnupg git wget build-essential python3 python3-dev \
 && apt-get install -y python3-setuptools python3-pip libatlas3-base \
 && apt-get install -y libatlas-dev libatlas-base-dev libblas3 libblas-dev cython

RUN git clone https://github.com/numpy/numpy.git
WORKDIR /numpy

RUN python3 setup.py build --fcompiler=gnu95 install 
RUN pip3 install nose

CMD ["python3", "/numpy/numpy/tests/test_ctypeslib.py"]

我通过成功构建测试并运行:

$ docker run -it test-numpy
.......
----------------------------------------------------------------------
Ran 7 tests in 0.004s

OK

另外,我不知道你想要用CMD ["numpy"]完成什么,因为它的目录。我添加了安装nose b / c,这是numpy测试所必需的。

你可以在docker中测试和玩numpy:

docker exec -it test-numpy bash