From the pastebin output I fail to see the process you took to install a new python version. Maybe it was done on a previous date, and maybe python was compiled and installed from source.
If yum still works from CLI, you might try to install the following packages, undoing .bashrc changes afterwards and relogin or rebooting the server to check if you get the correct python version (python -V
) and yum works correctly:
# note: a multi-line command follows
yum reinstall python-2.7.5-86.el7.x86_64 \
python2-acme-0.39.0-1.el7.noarch \
python2-boto-2.45.0-3.el7.noarch \
python2-certbot-0.39.0-1.el7.noarch \
python2-configargparse-0.11.0-1.el7.noarch \
python2-cryptography-1.7.2-2.el7.x86_64 \
python2-distro-1.2.0-3.el7.noarch \
python2-future-0.16.0-15.20181019gitbee0f3b.el7.noarch \
python2-gflags-2.0-5.el7.noarch \
python2-google-api-client-1.6.3-1.el7.noarch \
python2-josepy-1.2.0-1.el7.noarch \
python2-keyring-5.0-4.el7.noarch \
python2-mock-1.0.1-10.el7.noarch \
python2-oauth2client-4.0.0-2.el7.noarch \
python2-parsedatetime-2.4-5.el7.noarch \
python2-pyasn1-0.1.9-7.el7.noarch \
python2-pyasn1-modules-0.1.9-7.el7.noarch \
python2-PyDrive-1.3.1-3.el7.noarch \
python2-pyrfc3339-1.0-2.el7.noarch \
python2-rsa-3.4.1-1.el7.noarch \
python2-simplejson-3.10.0-2.el7.x86_64 \
python2-six-1.9.0-0.el7.noarch \
python2-uritemplate-3.0.0-1.el7.noarch \
python-backports-1.0-8.el7.x86_64 \
python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch \
python-cffi-1.6.0-5.el7.x86_64 \
python-chardet-2.2.1-3.el7.noarch \
python-configobj-4.7.2-7.el7.noarch \
python-dateutil-1.5-7.el7.noarch \
python-decorator-3.4.0-3.el7.noarch \
python-enum34-1.0.4-1.el7.noarch \
python-fasteners-0.9.0-2.el7.noarch \
python-firewall-0.6.3-2.el7_7.2.noarch \
python-GnuPGInterface-0.3.2-11.el7.noarch \
python-gobject-base-3.22.0-1.el7_4.1.x86_64 \
python-httplib2-0.9.2-1.el7.noarch \
python-idna-2.4-1.el7.noarch \
python-iniparse-0.4-9.el7.noarch \
python-ipaddress-1.0.16-2.el7.noarch \
python-IPy-0.75-6.el7.noarch \
python-javapackages-3.4.1-11.el7.noarch \
python-libs-2.7.5-86.el7.x86_64 \
python-linux-procfs-0.4.11-4.el7.noarch \
python-lockfile-0.9.1-4.el7.centos.noarch \
python-lxml-3.2.1-4.el7.x86_64 \
python-ndg_httpsclient-0.3.2-1.el7.noarch \
python-paramiko-2.1.1-9.el7.noarch \
python-perf-3.10.0-1062.4.1.el7.x86_64 \
python-ply-3.4-11.el7.noarch \
python-pwquality-1.2.3-5.el7.x86_64 \
python-pycparser-2.14-1.el7.noarch \
python-pycurl-7.19.0-19.el7.x86_64 \
python-pyudev-0.15-9.el7.noarch \
python-requests-2.6.0-7.el7_7.noarch \
python-requests-toolbelt-0.8.0-1.el7.noarch \
python-schedutils-0.4-6.el7.x86_64 \
python-setuptools-0.9.8-7.el7.noarch \
python-six-1.9.0-2.el7.noarch \
python-slip-0.4.0-4.el7.noarch \
python-slip-dbus-0.4.0-4.el7.noarch \
python-sssdconfig-1.16.4-21.el7.noarch \
python-tdb-1.3.16-1.el7.x86_64 \
python-urlgrabber-3.10-9.el7.noarch \
python-urllib3-1.10.2-7.el7.noarch \
python-zope-component-4.1.0-5.el7.noarch \
python-zope-event-4.0.3-2.el7.noarch \
python-zope-interface-4.0.5-4.el7.x86_64 \
yum-3.4.3-163.el7.centos.noarch \
yum-cron-3.4.3-163.el7.centos.noarch \
yum-metadata-parser-1.1.4-10.el7.x86_64 \
yum-plugin-changelog-1.1.31-52.el7.noarch \
yum-plugin-fastestmirror-1.1.31-52.el7.noarch
Without having all the details its hard for me to say the best way to solve it (maybe other users have more experience with python or with this specific problem and can give you better advice). I would recommend having a backup before going any further in the troubleshooting process.
If python was compiled and you still have the folder with the sources you can check what it did with make -n install
or make -n altinstall
to try to manually revert the changes (with a lot of patience).
Here’s a similar problem and how that person fixed it:
waysquare script to manually delete python files
#!/bin/bash
prefix='/usr/local/'
pyver='2.7'
rm -rf -I \
${prefix}bin/python${pyver} \
${prefix}bin/pip${pyver} \
${prefix}bin/pydoc \
${prefix}bin/include/python${pyver} \
${prefix}lib/libpython${pyver}.a \
${prefix}lib/python${pyver} \
${prefix}bin/python${pyver} \
${prefix}bin/pip${pyver} \
${prefix}bin/include/python${pyver} \
${prefix}lib/libpython${pyver}.a \
${prefix}lib/python${pyver} \
${prefix}lib/pkgconfig/python-${pyver}.pc \
${prefix}lib/libpython${pyver}m.a \
${prefix}bin/python${pyver}m \
${prefix}bin/2to3-${pyver} \
${prefix}bin/python${pyver}m-config \
${prefix}bin/python${pyver}-config \
${prefix}bin/idle${pyver} \
${prefix}bin/pydoc${pyver} \
${prefix}bin/pyvenv-${pyver} \
${prefix}share/man/man1/python${pyver}.1 \
${prefix}include/python${pyver}m
# ${prefix}bin/pydoc ## WARN: skip if other pythons in local exist.
if yum doesn’t work, downloading required packages (wget) from http://mirror.centos.org/centos-7/7/os/x86_64/Packages/
and installing them with something like rpm -Uvh --replacefiles --replacepkgs *.rpm
or rpm -Uvh --force *.rpm
logout/login or reboot and check if it’s working