I have 3 versions of python on my Ubuntu computer - 2.7, 3.5, 3.6, and I want to get rid off all these 3 altogether and just have only one version of python3 when I upgrade to 18.04. What will happen to them when I upgrade? And also how can I completely uninstall any one version of python from my current Ubuntu desktop?
Updating to Bionic Beaver (18.04) won't change your Python installations as long as the upgrades go well and as planned. I would recommend to make a backup first, because sometimes they don't.
With 18.04 Python 2 is no longer comes preinstalled, and Python 3 has been updated to 3.6 - but as said: your manual installation stays as it is.
To uninstall, you can use e.g. (change for your need)
sudo apt-get remove python2.7
but there could be some dependencies preventing you to so so. Backward compatibility isn't so easy with Python. My personal recommondation would be to keep at least one 2.x version.
Some credit goes here: How can I remove python 2.7 after installing python 3.3?
If you just don't want to type
python3, you could also add an alias to your bash's configuration file, so when you'll write python in your terminal, it will be like writing python3. This is useful, but potentially can create misunderstanding.
HOW TO DO
at the bottom of the
~/.bashrc file (or simply enter this in your console with sufficient rights
echo "alias python=python3" >> ~/.bashrc)
from the terminal to update bash with the changes (Source).