python3.7怎么安装pip用pip_使用python3.7版本的aws-sam-cli软件包进行pip安装

In the below docker file:

FROM alpine:latest

ENV HOME /home/samcli

ENV PATH $HOME/.local/bin:$PATH

RUN mkdir /root/bin /aws; \

apk add --no-cache groff less bash python jq curl py-pip tzdata

RUN ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime

RUN apk add --no-cache --virtual .build-deps gcc python2-dev python3-dev linux-headers musl-dev && \

pip install --upgrade pip; \

adduser samcli -Du 5566; \

chown -R samcli $HOME;

USER samcli

WORKDIR $HOME

RUN pip install --user --upgrade awscli aws-sam-cli;

USER root

RUN apk del .build-deps; \

rm -rf /var/cache/apk/*

Layer(RUN pip install --user --upgrade awscli aws-sam-cli;) is installing with python 2.7, despite image has python3.7 installed.

I see below deprecation error when installing python package:

Step 9/11 : RUN pip install --user --upgrade awscli aws-sam-cli;

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/

How to install aws package with python3.7?

because below command is using python2

pip install --user --upgrade awscli aws-sam-cli;

解决方案

I would recommend using python offical image based on alpine so you will do not need to maintain and install the python version. Below base image is base on alpine 3.9 and python version is 3.7

FROM python:3.7-alpine3.9

ENV HOME /home/samcli

ENV PATH $HOME/.local/bin:$PATH

RUN ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime

RUN apk add --no-cache --virtual .build-deps python2-dev python3-dev gcc linux-headers musl-dev && \

adduser samcli -Du 5566; \

chown -R samcli $HOME;

RUN apk add --no-cache groff less bash jq curl py-pip tzdata

USER samcli

WORKDIR $HOME

RUN pip install --user --upgrade awscli aws-sam-cli;

USER root

RUN apk del .build-deps; \

rm -rf /var/cache/apk/*

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值