问题描述
我目前正在从Alpine:3.7构建图像。
我遇到两个问题:
- 摆锤(特别是 python-dateutils 软件包)
- service_identity(特别是 attrs 软件包)
我收到的错误是:
注意:所有软件包都使用pip下载预先缓存在目录中。 / p>
dockerfile如下所示:
运行apk add --no -cache --virtual .build-deps< dev软件包>
&& apk添加--no-cache --update python3
&& pip3 install --upgrade pip setuptools
RUN pip3 install -f ./python-packages --no-index -r requirements.txt ./python-packages/pkgs
....
dev软件包,例如libffi-dev,libressl-dev等。
显然,在使用以下方式升级pip时:
pip3 install --upgrade pip setuptools
我删除了pip升级和安装工作。现在,我一直在研究在alpine上升级pip的正确方法,并在执行此检查:
if [! -e / usr / bin / pip];然后ln -s pip3 / usr / bin / pip; fi&& if
如果[[! -e / usr / bin / python]];然后ln -sf / usr / bin / python3 / usr / bin / python; fi&& \
仅在调用 pip3 通过在python和系统二进制文件的目录上进行符号链接来实现strong> pip 命令。
I am currently building an image from alpine:3.7.
There are two packages that I am having problems with:
- pendulum (specifically python-dateutils package)
- service_identity (specifically attrs package)
The error that I receive it is:
Note: all packages are pre-cached on a directory using pip download.
The dockerfile looks as follows:
RUN apk add --no-cache --virtual .build-deps <dev packages>
&& apk add --no-cache --update python3
&& pip3 install --upgrade pip setuptools
RUN pip3 install -f ./python-packages --no-index -r requirements.txt ./python-packages/pkgs
....
dev-packages such as libffi-dev, libressl-dev, etc.
Apparently when upgrading pip with:
pip3 install --upgrade pip setuptools
I removed pip upgrading and installation worked. Now, I have been researching the correct way to upgrade pip on alpine and found a Dockerfile in a github repo that does this check:
if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi && \
if [[ ! -e /usr/bin/python ]]; then ln -sf /usr/bin/python3 /usr/bin/python; fi && \
Which makes sure that pip3 is being referred when calling just pip command by doing a symbolic link on python and system binaries' directories.
这篇关于在Alpine中安装python3软件包时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!