-1

I set up a virtual machine running Ubuntu on Azure:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.5 LTS
Release:    16.04
Codename:   xenial

Then verified the Python binaries and versions:

$ which python
/usr/bin/python
$ python --version
Python 2.7.12
$ which python3
/usr/bin/python3
$ python3 --version
Python 3.5.2

I installed Python 3.6 with

$ sudo add-apt-repository ppa:deadsnakes/ppa
$ sudo apt-get update
$ sudo apt-get install python3.6

I then removed it with

$ sudo apt-get remove python3.6
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libpython3.6-minimal libpython3.6-stdlib python3.6-minimal
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  python3.6
0 upgraded, 0 newly installed, 1 to remove and 6 not upgraded.
After this operation, 334 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 85368 files and directories currently installed.)
Removing python3.6 (3.6.8-1+xenial1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for man-db (2.7.5-1) ...

But it's still installed:

$ python3 --version
Python 3.5.2
$ python3.6 --version
Python 3.6.8

And now I can no longer remove it because apt-get says it's not installed:

$ sudo apt-get remove python3.6
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'python3.6' is not installed, so not removed
The following packages were automatically installed and are no longer required:
  libpython3.6-minimal libpython3.6-stdlib python3.6-minimal
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.

How can I remove it?

2 Answers 2

3

Anybody else here who tried or wants to try the same thing, don't remove Python3 this way on Ubuntu ! It might remove your whole ubuntu-desktop. In case you run into problems:

sudo apt-get install python3-all
sudo apt-get install gnome-terminal
sudo apt-get install ubuntu-desktop

In case you are unable to open the terminal, press Ctrl+Alt+F1 to get a shell and run same commands.

0
2

You need to remove the packages which were installed along with python3.6:

sudo apt autoremove

This will remove the packages which apt-get told you about when you removed python3.6:

The following packages were automatically installed and are no longer required:
  libpython3.6-minimal libpython3.6-stdlib python3.6-minimal
Use 'sudo apt autoremove' to remove them.

including python3.6-minimal which is where the python3.6 binary comes from.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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