CentOS7 如何安装python3.8

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

  • 一、卸载Python3.6
// 查看版本 
[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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容