python不是解压就能用的,得先编译,如果不小心删除了原来的python,那就彻底删干净,再重新安装
删除python包
rpm -qa|grep python|xargs rpm -ev --allmatches --nodeps ##强制删除系统安装程序python包及其相关
whereis python |xargs rm -frv ##删除所有残余文件 ##xargs,允许你对输出执行其他某些命令
whereis python ##验证删除,返回无结果
删除yum
rpm -qa|grep yum|xargs rpm -ev --allmatches --nodeps
whereis yum |xargs rm -frv
1.下载相应的rpm包
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/python-2.6.6-66.el6_8.x86_64.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/python-devel-2.6.6-66.el6_8.x86_64.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/python-libs-2.6.6-66.el6_8.x86_64.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/python-pycurl-7.19.0-9.el6.x86_64.rpm
wgt http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/python-setuptools-0.6.10-4.el6_9.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/rpm-python-4.8.0-59.el6.x86_64.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/yum-utils-1.1.30-41.el6.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/yum-plugin-protectbase-1.1.30-41.el6.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/yum-plugin-aliases-1.1.30-41.el6.noarch.rpm
2. rpm相应包
rpm -Uvh --replacepkgs python*.rpm
rpm -Uvh --force --nodeps --replacepkgs rpm-python*.rpm yum*.rpm
安装python3.7.3
1.下载/解压
2.cd /opt/python-3.7.3 mv python-3.7.3 python3
3.configure --prefix=/opt/python3 --enabled-shard
4.make && make install
5.将lib放到配置库里
#cd /etc/ld.so.conf.d
#vim python3.conf (/opt/python3/lib)
#ldconfig
6.配置环境变量
export PYTHON_HOME=/opt/python3
export PATH=$PATH:$PYTHON_HOME/bin
source /etc/profile.d/bigdata.sh
注意:前面卸载部分是参考的别的大神的经验,但现在找不到出处了,希望原作者看到后跟我联系,我加上转载链接