-3

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

  • 11
    Congratulations. Looks like you may have thoroughly trashed your Ubuntu install. Apt depends upon Python3 to work properly. Also, NEVER use rm to remove packages that were installed by apt. Your command isn't detecting anything - apt is simply querying it's internal database...which no longer matches reality. – user535733 Oct 2 '19 at 18:09
  • 7
    your best course of action is probably a re-install. make a backup of your personal files from the live session prior to reinstalling. you can do that without a format if needed but that will leave trails from the older install. – Rinzwind Oct 2 '19 at 18:16
0

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.

  • I don't think APT will work and system is recoverable unless packages are manually downloaded from packages.ubuntu.com and installed using DPKG. – Kulfy Oct 2 '19 at 18:34
  • apt needs python. There is a way to reinstall apt without using apt or dpkg though but I can'f find how D: – Rinzwind Oct 2 '19 at 18:39
  • This was the major issue in "might work". As @Kulfy indicated, you could try downloading the .deb files for python and installing them manually using dpkg. – doneal24 Oct 3 '19 at 15:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.