I need to remove python 2.7.16 but even If I use: sudo apt-get purge python2.7
doing python --version
still prints Python 2.7.16
I need to have python 3.6+. plz help
Asked
Active
Viewed 1,124 times
0

ICE_Plane
- 13
3 Answers
2
There is no need to remove python 2.7.16, you could install both versions side by side.
Then you can choose which one is the default that is executed with python
using update-alternatives
, as shown here.
You could always run explicitly python3
as mentioned by ICE_Plane, but it would not work with scripts, etc., which invoke python
.
Actually, you probably wouldn't want to remove python 2.7.16, see Is it safe to remove Python 2.7.15rc1 from Ubuntu 18.04?

sancho.s ReinstateMonicaCellio
- 14,674
- 11
- 44
- 97
0
Starting with the Debian 11 (bullseye) and Ubuntu 20.04 LTS (focal) releases use
sudo apt install python-is-python3

ExploitFate
- 801
python2
is installed by default, you've installed it, or its necessary. You've tagged debian packaging (shared between Ubuntu and Debian), so how does that apply to your question? – guiverc May 19 '21 at 22:33