Pip 皮普抱怨包装问题

Pip 皮普抱怨包装问题,pip,dockerfile,Pip,Dockerfile,我正在尝试安装cffi软件包,因为bcrypt依赖于它,但我一直收到这个错误,这对我来说毫无意义。它说它找不到cffi的相关版本,但在需求文件中我列出了最新版本 为什么我会犯这个错误 我正在使用Docker创建图像: FROM python:3.6.5-alpine WORKDIR /app ADD . /app RUN pip3 install -r requirements.txt EXPOSE 5000 CMD ["python", "main.py"] # I've got set

我正在尝试安装cffi软件包,因为bcrypt依赖于它,但我一直收到这个错误,这对我来说毫无意义。它说它找不到cffi的相关版本,但在需求文件中我列出了最新版本

为什么我会犯这个错误

我正在使用Docker创建图像:

FROM python:3.6.5-alpine

WORKDIR /app
ADD . /app
RUN pip3 install -r requirements.txt
EXPOSE 5000
CMD ["python", "main.py"]   # I've got set alias on Python == Python 3.6
requirements.txt:

alembic==1.0.9
cffi==1.12.3
bcrypt==3.1.6
blinker==1.4
Click==7.0
Faker==1.0.5
Flask==1.0.2
Flask-Bcrypt==0.7.1
Flask-Login==0.4.1
Flask-Mail==0.9.1
Flask-Migrate==2.4.0
Flask-Moment==0.7.0
Flask-Script==2.0.6
Flask-SQLAlchemy==2.3.2
Flask-Testing==0.7.1
Flask-WTF==0.14.2
itsdangerous==1.1.0
Jinja2==2.10.1
MarkupSafe==1.1.1
PyMySQL==0.9.3
SQLAlchemy==1.3.3
text-unidecode==1.2
Werkzeug==0.15.2
WTForms==2.2.1
但是,在建筑时:

Step 1/6 : FROM python:3.6.5-alpine
---> 5be6d36f77ee
Step 2/6 : WORKDIR /app
---> Using cache
---> f9e7cc24d767
Step 3/6 : ADD . /app
---> 7d9d5bdcf5d6
Step 4/6 : RUN pip3 install -r requirements.txt
---> Running in b455df1a48e2
Collecting alembic==1.0.9 (from -r requirements.txt (line 1))
Downloading https://files.pythonhosted.org/packages/fc/42/8729e2491fa9b8eae160d1cbb429f61712bfc2d779816488c25cfdabf7b8/alembic-1.0.9.tar.gz (1.0MB)
Collecting bcrypt==3.1.6 (from -r requirements.txt (line 2))
Downloading https://files.pythonhosted.org/packages/ce/3a/3d540b9f5ee8d92ce757eebacf167b9deedb8e30aedec69a2a072b2399bb/bcrypt-3.1.6.tar.gz (42kB)
Could not find a version that satisfies the requirement cffi>=1.1 (from versions: )
No matching distribution found for cffi>=1.1
You are using pip version 10.0.1, however version 19.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The command '/bin/sh -c pip3 install -r requirements.txt' returned a non-zero code: 1

安装
cffi
需要
gcc
,这不包括在
alpine
图像中

如果运行

docker运行-it python:3.6.5-sh
然后在容器中运行

pip install cffi==1.12.3
将获得:

    unable to execute 'gcc': No such file or directory
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-juslf1fb/cffi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-md66dk3u/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-juslf1fb/cffi/
要解决此问题,您可以使用
stretch
版本的
python
图像,如:

FROM python:3.6.5-stretch