Dockerfile: Ubuntu 18.04 - 卸载 Python 3.6 安装 Python 3.10 为默认版本
FROM ubuntu:18.04
卸载原有的 Python 3.6
RUN apt-get update && apt-get remove -y python3.6
添加 PPA 源以安装 Python 3.10
RUN apt-get install -y software-properties-common &&
add-apt-repository -y ppa:deadsnakes/ppa &&
apt-get update &&
apt-get install -y python3.10
设置 Python 3.10 为默认版本
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
CMD ['python3']
原文地址: https://www.cveoy.top/t/topic/n6kR 著作权归作者所有。请勿转载和采集!