Detailed explanation of the process of deleting the built-in version of Python in Linux

Detailed explanation of the process of deleting the built-in version of Python in Linux

Big pit, don't easily delete the version of Python that comes with the Linux system

1. Uninstall Python (to prevent incomplete uninstallation)

rpm -qa|grep python|xargs rpm -ev --allmatches --nodeps #Forced deletion of installed programs and their associations
whereis python|xargs rm -frv #Delete all remaining files #xargs allows you to execute other commands on the output

2. Uninstall yum

rpm -qa|grep yum|xargs rpm -ev --allmatches --nodeps
rm -rf /etc/yum.repos.d/*
whereis yum|xargs rm -frv

3. Verify whether the deletion is complete

whereis python #Verify deletion, no results should be returned
whereis yum

4. Install python and yum

Software download address (my system is centos 7.5.1804)

Check the Linux system version: cat /etc/redhat-release

http://vault.centos.org/7.5.1804/os/x86_64/Packages/

The required files are as follows: (Just download the version corresponding to your system)

wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/lvm2-python-libs-2.02.177-4.el7.x86_64.rpm
wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/libxml2-python-2.9.1-6.el7_2.3.x86_64.rpm
wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-libs-2.7.5-68.el7.x86_64.rpm
wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-ipaddress-1.0.16-2.el7.noarch.rpm
wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-backports-1.0-8.el7.x86_64.rpm
wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm
wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-2.7.5-68.el7.x86_64.rpm
wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-pycurl-7.19.0-19.el7.x86_64.rpm
wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm
wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-setuptools-0.9.8-7.el7.noarch.rpm
wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-kitchen-1.1.1-5.el7.noarch.rpm
wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-chardet-2.2.1-1.el7_1.noarch.rpm<br>
wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/rpm-python-4.11.3-32.el7.x86_64.rpm
wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-utils-1.1.31-45.el7.noarch.rpm
wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-3.4.3-158.el7.centos.noarch.rpm
wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-plugin-aliases-1.1.31-45.el7.noarch.rpm
wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-plugin-protectbase-1.1.31-45.el7.noarch.rpm
wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm

5. Upload and install

Here I take the link and directly wget to a directory, then enter the directory and execute the command

rpm -Uvh --replacepkgs lvm2-python-libs*.rpm --nodeps --force
 
rpm -Uvh --replacepkgs libxml2-python*.rpm --nodeps --force
 
rpm -Uvh --replacepkgs python*.rpm --nodeps --force
 
rpm -Uvh --replacepkgs rpm-python*.rpm yum*.rpm --nodeps --force

After successful installation, execute

yum
Python

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • How to execute Linux Bash commands in Python3
  • Python captures shell/bash script output example
  • Methods of counting CPU utilization using python and bash
  • Tutorial on using Python scripts to implement some Bash Shells in Linux
  • bash: /usr/bin/autocrorder: /usr/bin/python^M: bad interpreter: No such file or directory
  • Python remote linux command execution implementation
  • How to deploy a python project to a linux server
  • How to install Python3 on Linux and coexist with the system's own Python2
  • Detailed method of packaging Python3 program under Windows and Linux
  • How to combine Python and Bash

<<:  Solve the MySQL login 1045 problem under centos

>>:  Vue implements verification code countdown button

Recommend

MySQL date functions and date conversion and formatting functions

MySQL is a free relational database with a huge u...

Detailed tutorial on installing MySQL offline on CentOS7

1. Delete the original mariadb, otherwise mysql c...

Use semantic tags to write your HTML compatible with IE6,7,8

HTML5 adds more semantic tags, such as header, fo...

VMware15 installation of Deepin detailed tutorial (picture and text)

Preface When using the Deepin user interface, it ...

MySQL uninstall and install graphic tutorial under Linux

This is my first time writing a blog. I have been...

MySQL insert json problem

MySQL 5.7.8 and later began to support a native J...

A brief discussion on the problem of forgotten mysql password and login error

If you forget your MySQL login password, the solu...

Detailed tutorial on how to quickly install Zookeeper in Docker

Docker Quickly Install Zookeeper I haven't us...

How to enter and exit the Docker container

1 Start the Docker service First you need to know...

JavaScript adds prototype method implementation for built-in objects

The order in which objects call methods: If the m...

Full steps to create a password generator using Node.js

Table of contents 1. Preparation 2. Writing comma...

MySQL tutorial DML data manipulation language example detailed explanation

Table of contents 1. Data Manipulation Language (...

Tips for implementing list loop scrolling based on jQuery (super simple)

I saw a good idea and recorded it. I have used jQ...

SQL insert into statement writing method explanation

Method 1: INSERT INTO t1(field1,field2) VALUE(v00...