As you might know, starting from Ubuntu 20.04 LTS, Python 2 is no longer a dependency and not installed by default anymore. However, there are still some caveats:
- When installing Python using
apt install python
it will still install Python 2 - When upgrading from an older Ubuntu version,
python
will still point to Python 2
The fix is simple: install the python-is-python3
package:
sudo apt install python-is-python3
After installing this package, running apt install python
will give you Python 3 and if you had already installed Python, python
will now actually point to Python 3.
Finally, no more Python 2!