CenterOS8安装python3.7.6

1、下载python3.7.6
wget https://www.python.org/ftp/python/3.7.6/Python-3.7.6.tgz
2、解压
tar -zxvf Python-3.7.6.tgz
cd Python-3.7.6
./configure prefix=/usr/local/python3

提示:prefix是指定编译安装的文件夹

3、在解压目录下编译:
make && make install
4、我的系统里原本有python3.6.8,切换为刚刚安装的
mv /usr/bin/python3 /usr/bin/python36
mv /usr/bin/pip3 /usr/bin/pip36
ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
pip3 install --upgrade pip
python3 --version
pip3 --version
打印结果:
python3 --version
Python 3.7.6
pip3 --version
pip 22.0.4 from /usr/local/python3/lib/python3.7/site-packages/pip (python 3.7)

你可能感兴趣的:(CenterOS8安装python3.7.6)