In this tutorial, How to solve problem python not found on Ubuntu. I run a python program in the Linux terminal as below:
python script.shUse python command in Ubuntu or some other distributions will throw an error as below:
[email protected]:~$ python
Command 'python' not found, did you mean:
command 'python3' from deb python3
command 'python' from deb python-is-python3
The python command is actually python3 here. Because the Python package is not installed as python but python3 or python2
When Python version 3 released, distributions start both python2 and python3. Python 2 is no longer supported and Python 3.x get on Ubuntu.
How to python not found on Ubuntu fixed
To check Python version 3 installed on your server as the picture as below:
If you don't have any python verion, you need install python version 3 as command below:sudo apt install python3
Use python3 instead of python
To check version
python3 --versionrun a python program
python3 script.sh
Link python3 as python
you can create a permanent in your .bashrc file
alias python='python3'
For Ubuntu 20.04 and higher versions, you have a package that does all link creation automatically if you install the python-is-python3 package.
sudo apt install python-is-python3
You can see that symbolick link have been created and you can use the python command