在我的 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
我应该怎么办?!
原文由 Mehdi 发布,翻译遵循 CC BY-SA 4.0 许可协议
推荐的基础镜像
正如我在评论中所建议的,您可以编写一个如下所示的 Dockerfile:
上面的命令示例可以在运行时 (
docker build --pull -t test . && docker run --rm -it test
) 确认此映像基于 GNU/Linux 发行版“Debian stable”。通用
Dockerfile
模板最后给出一个全面的答案,请注意,关于 Python 依赖项的一个好的做法是在专用文本文件 中以声明性的方式 指定它们(按字母顺序,以方便查看和更新),因此对于您的示例,您可能想要编写以下文件:
更准确地说,这是 Docker 官方镜像
python
的文档中建议的方法,§. 如何使用此图像