备注
centos 环境下 不建议完全直接删除原有自带的python, 可能会造成 yum 等无法使用
如果想要完全卸载自带python,请使用以下命令:
script1 2 3 4 5 6 7 8
| # 卸载 rpm -qa|grep python|xargs rpm -ev --allmatches --nodeps
# 删除残余文件 whereis python |xargs rm -frv
# 验证删除 whereis python
|
准备依赖
script1
| yum install wget openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel python3-devel
|
指定源码包存放位置,以下都在该位置进行
script
获取源码包
script1 2 3
| # www.python.org/ftp/python wget https://www.python.org/ftp/python/3.8.4/Python-3.8.4.tgz tar zxvf Python-3.8.4.tgz
|
配置并安装
script1 2 3 4 5 6 7 8 9
| cd Python-3.8.4
./configure --with-ssl --enable-optimizations --prefix=/usr/local/python3
make && make install
ln -s /usr/local/python/bin/python3 /usr/bin/python3
ln -s /usr/local/python/bin/pip3 /usr/bin/pip3
|
检查安装
script