26 lines
998 B
Docker
26 lines
998 B
Docker
# ---------- Python 3.8 + 清华源 ----------
|
||
FROM ccr.ccs.tencentyun.com/somunslotus/ubuntu:20.04
|
||
|
||
ENV DEBIAN_FRONTEND=noninteractive
|
||
|
||
# 切换为阿里云源(HTTP)
|
||
RUN sed -i 's|http://archive.ubuntu.com/ubuntu/|http://mirrors.aliyun.com/ubuntu/|g' /etc/apt/sources.list && \
|
||
sed -i 's|http://security.ubuntu.com/ubuntu/|http://mirrors.aliyun.com/ubuntu/|g' /etc/apt/sources.list && \
|
||
apt-get clean && apt-get update
|
||
|
||
|
||
# 安装 Python 3.8(系统默认版本)及基本工具
|
||
RUN apt-get install -y --no-install-recommends \
|
||
python3.8 python3.8-venv python3.8-distutils python3-pip curl ca-certificates git vim build-essential && \
|
||
ln -sf /usr/bin/python3.8 /usr/bin/python && \
|
||
python -m pip install --upgrade pip && \
|
||
mkdir -p /root/.pip && \
|
||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||
|
||
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
|
||
|
||
# 验证 Python 与 pip 版本
|
||
RUN python --version && pip --version
|
||
|
||
CMD ["python3.8"]
|