I can't check Python version on Ubuntu 20.04 [duplicate]
I was trying to check the Python version on my device. In the terminal I used the command python --version
. But it outputs a message saying
Command 'python' not found, did you mean:
command 'python3' from deb
command 'python' from deb python-is-python3
I tried reinstalling Python 3. But it still shows the same thing. What should I do now?
Solution 1:
Up until Ubuntu 18.04 LTS, both python2 and python3 were preinstalled on Ubuntu. Since Ubuntu 18.04 LTS, things have changed. Python2 is not preinstalled. Only python3 (v3.8.2 in 20.04) is preinstalled. At this moment if you run python3 --version
, you will see version 3.8.2 is installed. However if you have also installed python 2 (on your own, it is not preinstalled), then you can use python2 --version
or python --version
to check the version of python2.
To check info about python3, you will have to use python3 --version
or something which starts with python3
explicitly. Where as python
and python2
will refer python2.
EDIT 1
The reason they did this was because python2 itself has reached EOL (end of life).
Related news article.
EDIT 2
Python 2 has now been moved to from main repository to universe repository.
The four main repositories are:
Main - Canonical-supported free and open-source software. Universe - Community-maintained free and open-source software. Restricted - Proprietary drivers for devices. Multiverse - Software restricted by copyright or legal issues.
EDIT 3
To make python
command to point to python3, install python-is-python3
package by running sudo apt install python-is-python3
command in terminal.