[英]Error when installing python3 packages in alpine
I am currently building an image from alpine:3.7. 我目前正在建立阿尔卑斯山的图像:3.7。
There are two packages that I am having problems with: 有两个我遇到问题的包:
The error that I receive it is: 我收到的错误是:
Could not find a version that satisfies the requirement setuptools (from versions: ) No matching distribution found for setuptools
找不到满足要求setuptools的版本(来自版本:)没有找到setuptools的匹配分发
Note: all packages are pre-cached on a directory using pip download. 注意:使用pip download将所有包预先缓存在目录中。
The dockerfile looks as follows: dockerfile如下所示:
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. 开发包,如libffi-dev,libressl-dev等。
I'm not sure about the full list of dev-packages to build in the question, but it should be the following: g++
(GNU C++ standard library and compiler), python3-dev
(python3 development files), libffi-dev
(libffi development files) and openssl-dev
(Toolkit for SSL v2/v3 and TLS v1 development files). 我不确定要在这个问题中构建的dev-package的完整列表,但它应该是以下内容:
g++
(GNU C ++标准库和编译器), python3-dev
(python3开发文件), libffi-dev
(libffi)开发文件)和openssl-dev
(用于SSL v2 / v3和TLS v1开发文件的工具包)。
The Dockerfile
is: Dockerfile
是:
FROM alpine:3.7
RUN apk add --no-cache --virtual .build-deps g++ python3-dev libffi-dev openssl-dev && \
apk add --no-cache --update python3 && \
pip3 install --upgrade pip setuptools
RUN pip3 install pendulum service_identity
Apparently when upgrading pip with: 显然在升级点数时:
pip3 install --upgrade pip setuptools
I removed pip upgrading and installation worked. 我删除了pip升级和安装工作。 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:
现在,我一直在研究升级pip on alpine的正确方法,并在github repo中找到了一个Dockerfile来执行此检查:
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. 这通过在python和系统二进制文件的目录上执行符号链接来确保在调用pip命令时引用pip3 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.