Ubuntu安装python步骤

官网下载
link

#或者

wget https://www.python.org/ftp/python/3.8.10/Python-3.8.10.tgz
# 然后解压
tar -zxvf Python-3.8.10.tgz

# 安装相关依赖 

sudo apt update
sudo apt install \
    build-essential \
    curl \
    libbz2-dev \
    libffi-dev \
    liblzma-dev \
    libncursesw5-dev \
    libreadline-dev \
    libsqlite3-dev \
    libssl-dev \
    libxml2-dev \
    libxmlsec1-dev \
    llvm \
    make \
    tk-dev \
    wget \
    xz-utils \
    zlib1g-dev



cd Python-3.8.10
./configure  --prefix=/usr/local/pyhton3.8
make
make install

ln -s /home/Python-3.9.14/bin/python3.9 /usr/bin/python
ln -s /home/Python-3.9.14/bin/pip3.9 /usr/local/bin/pip3


你可能感兴趣的:(ubuntu,python,linux)