It only takes two steps to install Python3 offline on CentOS 7

1. Installation file preparation

python3 environment dependency package: py3_lib.tar.gz
python3 installation package: Python-3.9.9.tar.xz
Baidu network disk link: https://pan.baidu.com/s/1-m99RwWLm9Ko3MMQ2Xr-1g
extraction code: mivw

2. Upload the python3 environment dependency package and installation package, and unzip it

# 先创建文件夹
mkdir /usr/local/python3
 
cd /usr/local/python3
# 上传python环境依赖包到此目录下,解压
tar -zxvf py3_lib.tar.gz
#进入解压目录
cd py3
#强制安装全部依赖
rpm -ivh *.rpm --force --nodeps
 
cd /usr/local/python3
# 上传python3安装包到此目录下,解压
tar -xvJf  Python-3.9.9.tar.xz
#进入解压目录
cd Python-3.9.9
#开始安装python3
./configure --prefix=/usr/local/python3
make && make install

Finally, Successfully appears, which means the installation is successful, as shown in the figure below:
insert image description here

3. Configure the soft connection and check whether the installation is successful

#创建软连接
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
#验证版本
python3
# 查看版本
python3 -V
pip3 -V

Guess you like

Origin blog.csdn.net/weixin_43807520/article/details/128662769