centos7 安装 python3.8

安装依赖

yum install -y wget zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make 

下载源码并解压

wget https://www.python.org/ftp/python/3.8.13/Python-3.8.13.tgz
tar xvf Python-3.8.13.tgz

编译安装

cd Python-3.8.13
./configure --prefix=/usr/local/python3.8
make && make install

添加软连接

ln -s /usr/local/python3.8/bin/python3.8 /usr/bin/python3
ln -s /usr/local/python3.8/bin/pip3.8 /usr/bin/pip3

更新PIP

python3 -m pip install --upgrade pip

你可能感兴趣的:(linux运维,python,linux,numpy)