本文介绍了Docker安装了python 3.5.2而不是python 3.6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不明白为什么安装了python 3.5.2而不是python 3.6.因此,我无法执行python文件,因为我使用的是f字符串文字语法,该语法仅在python 3.6中可用.

I don't get it why python 3.5.2 is installed and not python 3.6. So I cannot execute my python file because I use f string literal syntax which is only available in python 3.6.

也许有人可以帮助我吗?

Maybe someone can help me?

FROM envoyproxy/envoy:latest

RUN apt-get update && apt-get -q install -y \
    curl \
    software-properties-common \
    python-software-properties
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt-get update && apt-get -q install -y \
    python3.6 \
    python3-pip
RUN python3.6 --version && pip3 --version
RUN pip3 install gunicorn
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
RUN mkdir /code
COPY . /code
WORKDIR /code

RUN pip3 install --no-cache-dir -r ./requirements.txt
ADD ./boot.sh /usr/local/bin/boot.sh
RUN chmod u+x /usr/local/bin/boot.sh

ENTRYPOINT /usr/local/bin/boot.sh

推荐答案

因为我们看看使用docker镜像,我们看到了:

Because if we look at envoy docker image we see:

FROM ubuntu:16.04

RUN apt-get update \
    && apt-get upgrade -y \
    && apt-get install -y ca-certificates \
    && apt-get autoremove -y \
    && apt-get clean \
    && rm -rf /tmp/* /var/tmp/* \
    && rm -rf /var/lib/apt/lists/*
...

默认情况下为python-3.5.2.

如果需要python-3.6-使用apt进行安装,或构建自己的映像.

If you need python-3.6 - install it with apt, or build your own image.

这篇关于Docker安装了python 3.5.2而不是python 3.6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-17 13:26
查看更多