Dockerfile: Ubuntu 18.04 with Python 3.10.0 as Default
FROM ubuntu:18.04
Update package lists
RUN apt-get update
Uninstall existing Python3.6
RUN apt-get remove -y python3.6
Install dependencies
RUN apt-get install -y build-essential wget libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev zlib1g-dev openssl libffi-dev python3-dev python3-setuptools
Download and install Python 3.10.0
RUN wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz && \ tar xzf Python-3.10.0.tgz && \ cd Python-3.10.0 && \ ./configure --enable-optimizations && \ make altinstall && \ cd .. && \ rm -rf Python-3.10.0.tgz Python-3.10.0
Set Python 3.10.0 as default version
RUN update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 1
Clean up
RUN apt-get autoremove -y && \ apt-get clean && \ rm -rf /var/lib/apt/lists/*
CMD ['python3', '--version']
原文地址: https://www.cveoy.top/t/topic/n6lc 著作权归作者所有。请勿转载和采集!