CentOS7 如何安装python3.8

2021-02-25  本文已影响0人  楍跑的鸟

工作需要使用Python3.8以上版本。因此需要卸载系统之前其他版本的 Python。以下就是我卸载其他版本,安装 Python3.8 版本步骤。

// 查看版本 
[root@localhost ~]#python -v
image.png
// 查找 Python 文件所在路径
[root@localhost ~]# whereis python
// 卸载删除 Python
[root@localhost ~]# rpm -qa|grep python3*|xargs rpm -ev --allmatches --nodeps
image.png
// 检测是否卸载删除干净
[root@localhost ~]# python
image.png
// 解压缩
[root@localhost ~]# tar -xvf Python-3.8.7.tgz
image.png
// 执行安装
// 运行脚本configure
[root@localhost ~]# cd Python-3.8.7
 
[root@localhost Python-3.8.7]# ./configure --prefix=/usr/local/python3

// make编译&make install安装
[root@localhost Python-3.8.7]#  make && make altinstall

// 运行make clean

// 删除一些临时文件 
[root@localhost Python-3.8.7]#  make clean

// 创建软链接
// ln -s -f 强制创建软连接
[root@localhost local] ln -s /usr/local/python3/bin/python3.8 /usr/bin/python3
 
[root@localhost local] ln -s /usr/local/python3/bin/pip3.8 /usr/bin/pip3
image.png
// 检测安装是否成功
[root@localhost ~]# python3 -V
image.png
上一篇 下一篇

猜你喜欢

热点阅读