我有一个Flask应用程序,具有以下 requirements.txt
chalice
matplotlib
sklearn
numpy
scipy
pandas
flask
flask_restful
和以下 Dockerfile :
FROM python:3.6.1-alpine
WORKDIR /project
ADD . /project
RUN pip install -r requirements.txt
CMD ["python","app.py"]
运行命令docker image build -t clf_test .
产生以下错误:
You are using pip version 9.0.1, however version 20.2.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
似乎由于某种原因无法安装matplotlib。
在本地运行pip install -r requirements.txt
不会产生任何错误
答案 0 :(得分:1)
\
必须从源代码构建,并且对其进行编译需要许多支持库以及可运行的C编译器。您可以弄清楚它们是什么并安装它们,以便其正确构建...
...或者您可以将matplotlib
基于非高山Dockerfile
映像,然后基于python:3.6.1
,然后再安装其他要求。例如,此构建没有错误:
apt-get install python3-matplotlib