CentOS7 系统默认的Python版本是2.7.5,在安装Anaconda python 2.7.11的时候,不小心把之前的Python删除了,然后系统桌面进不去了,只能通过远程登录进系统。最后发现根本原因还是内核版本从3.0更新到3.1导致的。
查看CentOS7版本信息:
[root@biostacs ~]# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.1.1503 (Core)
Release: 7.1.1503
Codename: Core
删除Anaconda Python
[root@biostacs ~]# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.1.1503 (Core)
Release: 7.1.1503
Codename: Core
直接删除 /root/Anaconda2文件夹
找到CentOS7版本对应的软件源
http://mirror.centos.org/centos-7/7/os/x86_64/Packages/
删除环境变量
在 /etc/profile、~/.bashrc里删除
重新安装Python
运行下面命令:
rpm -Uvh --replacepkgs http://mirror.centos.org/centos-7/7/os/x86_64/Packages/python-2.7.5-34.el7.x86_64.rpm
重新安装GNOME桌面
yum groupremove "X Window System" "GNOME Desktop Environment" -y
yum groupinstall "X Window System" "GNOME Desktop Environment" -y
yum update
yum uodate
yum groupremove "X Window System" "GNOME Desktop Environment" -y
yum groupinstall "X Window System" "GNOME Desktop Environment" -y
yum uodate
等待更新完成
本文永久更新链接地址:http://www.linuxidc.com/Linux/2017-06/144946.htm