我正在尝试从一个Dockerfile
中安装scipy
,但我无论如何都无法弄清楚该怎么做。
这是Dockerfile
的内容:
FROM python:3.5
ENV HOME /root
# Install dependencies
RUN apt-get update
RUN apt-get install -y gcc
RUN apt-get install -y build-essential
RUN apt-get install -y zlib1g-dev
RUN apt-get install -y wget
RUN apt-get install -y unzip
RUN apt-get install -y cmake
RUN apt-get install -y python3-dev
RUN apt-get install -y gfortran
RUN apt-get install -y python-numpy
RUN apt-get install -y python-matplotlib
RUN apt-get install -y ipython
RUN apt-get install -y ipython-notebook
RUN apt-get install -y python-pandas
RUN apt-get install -y python-sympy
RUN apt-get install -y python-nose
# Install Python packages
RUN pip install --upgrade pip
RUN pip install cython
# Install scipy
RUN apt-get install -y python-scipy
这会构建一个镜像,但是当我运行容器并尝试 import scipy
时,它会显示:
Python 3.5.1 (default, Mar 9 2016, 03:30:07)
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'scipy'
我尝试使用
RUN pip install scipy
和 RUN pip install git+https://github.com/scipy/scipy.git
,但在完成构建之前就出现了错误。
python3-scipy
吗?看起来你的系统默认使用 Python3。 - Sueverapt
安装所有Python2.x软件包,否则@jdesilvio。 - Sueverapt-get install python3-packagename
而不是apt-get install python-packagename
。 - Suever