ubuntu20.04编译安装python3.9

1.切换用户

sudo 账号名  或直接切换到root。  su -

2.系统升级一下:

apt update

apt upgrade -y

3。安装编译Python源程序所需的包

apt install build-essential libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev -y

apt-get install zlib1g-dev

4.在相应目录下载解压python3.9

mkdir /usr/local/bin/python

cd /usr/local/bin/ypthon

wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tgz
tar -xzvf Python-3.9.0.tgz

5.配置编译安装python3.9

cd Python-3.9.0
./configure --enable-optimizations
make
make install

6.验证是否安装成功

输入python3进入

Python 3.9.0 (default, Sep 12 2022, 16:13:02)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

你可能感兴趣的:(服务器,linux,运维,python)