在我的docker文件中,我想安装med2image python包(https://github.com/FNNDSC/med2image)。我使用以下代码:
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
python3.5 \
python3-pip \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN pip install nibabel pydicom matplotlib pillow
RUN pip install med2image
但是当我想要构建图像时出现以下错误:
Downloading https://files.pythonhosted.org/packages/6f/e5/948b023c7feb72adf7dfb26d90a13c838737bbf52be704f5ddd0878e3264/med2image-1.1.2.tar.gz
Complete output from command python setup.py egg_info:
Sorry, only Python 3.5+ is supported.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-FnNb_S/med2image/
The command '/bin/sh -c pip install med2image' returned a non-zero code: 1
我该怎么办?!
答案 0 :(得分:3)
其他一些答案/评论建议更改您的基本影像,但如果您想保留您的ubuntu 16.04,您也可以简单地指定您的pip / python版本以使用pip3
或pip3.5
那样:
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
python3.5 \
python3-pip \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN pip3 install nibabel pydicom matplotlib pillow
RUN pip3 install med2image
答案 1 :(得分:2)
正如我的评论中所建议的那样,您可以编写一个类似于:
的DockerfileFROM python:3
RUN pip install --upgrade pip && \
pip install --no-cache-dir nibabel pydicom matplotlib pillow && \
pip install --no-cache-dir med2image
CMD ["cat", "/etc/os-release"]
上面的命令示例可以在运行时确认(docker build -t test . && docker run --rm -it test
)此图像基于Debian GNU / Linux 8(jessie)。
答案 2 :(得分:1)
尝试pip3
RUN pip3 install nibabel pydicom matplotlib pillow
RUN pip3 install med2image
答案 3 :(得分:1)