跳转到主要内容

liunx安装python3&&制作python镜像

制作python3 docker镜像

FROM alpine
RUN apk update &&  \ 
    apk add --no-cache  mysql-client  \
    bash  \
    curl  \
    build-base \
    libffi-dev \
    openssl-dev \
    zlib-dev  \ 
    bzip2-dev \ 
    readline-dev  \ 
    sqlite-dev  


RUN wget https://www.python.org/ftp/python/3.10.14/Python-3.10.14.tgz && \
    tar -xvzf Python-3.10.14.tgz && \
    cd Python-3.10.14 && \
    ./configure --prefix=/usr/local --enable-optimizations && \
    make -j ${nproc} && \
    make install && \
    rm -rf /Python-3.10.14 && \
    rm -rf /Python-3.10.14.tgz

linux安装

apk update

apk add --no-cache  mysql-client  bash  curl  build-base libffi-dev openssl-dev zlib-dev  bzip2-dev readline-dev  sqlite-dev  


wget https://www.python.org/ftp/python/3.10.14/Python-3.10.14.tgz && \
tar -xvzf Python-3.10.14.tgz
cd Python-3.10.14 
./configure --prefix=/usr/local --enable-optimizations
make -j ${nproc}
make install 
rm -rf /Python-3.10.14 
rm -rf /Python-3.10.14.tgz