Remove All Python Versions [Duplicate]

CAUTION: All the below commands will COMPLETELY BREAK your OS.

I removed all version by doing :

sudo apt purge python-pip python-dev
 sudo rm -rf /usr/bin/python*
 sudo rm -rf /etc/python*
 sudo rm -rf /usr/local/lib/python*
 sudo rm -rf /usr/share/man/man1/python*
 sudo rm -rf /usr/share/python*
 sudo rm -rf /usr/local/bin/pip*

Now when i try to install again :

sudo apt-get install python3

It detects it is already installed ?

Any idea how to complety remove old versions ?

thanks

2

The proper course of action after breaking your system so thoroughly is to re-install. You might be able to fix the system by running

dpkg -l | grep python     # see what the system think's is installed
sudo mv /var/lib/dpkg/info/python* /tmp/   # get rid of the apt database files
sudo apt-get update
sudo apt-get install *list-of-packages*

where the list-of-packages came from the first command.

3
Chloe Bennett

Chloe Bennett

Culture, Media & Entertainment Columnist

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.

Share this article
Twitter Facebook Pinterest