在Alpine中安装python3软件包时出错 [英] Error when installing python3 packages in alpine

查看:947
本文介绍了在Alpine中安装python3软件包时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在从Alpine:3.7构建图像。



我遇到两个问题:




  • 摆锤(特别是 python-dateutils 软件包)

  • service_identity(特别是 attrs 软件包)



我收到的错误是:


找不到满足需求setuptools的版本(来自版本:)找不到setuptools的匹配分发版本。


注意:所有软件包都使用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的正确方法,并在 github repo 执行此检查:

  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:

Could not find a version that satisfies the requirement setuptools (from versions: ) No matching distribution found for setuptools

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软件包时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆