python command not found

In this troubleshooting guide we learn how to fix python command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

python: command not found

or when using sudo you get the following error message

sudo: python: command not found

Solutions to python: command not found

How To Fix python: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu python is provided by python-is-python3 package.

python-is-python3 is:

Starting with the Debian 11 (bullseye) and Ubuntu 20.04 LTS (focal) releases, all python packages use explicit python3 or python2 interpreter and do not use unversioned /usr/bin/python at all. Some third-party code is now predominantly python3 based, yet may use /usr/bin/python.

This is a convenience package which ships a symlink to point the /usr/bin/python interpreter at the current default python3. It may improve compatibility with other modern systems, whilst breaking some obsolete or 3rd-party software.

No packages may declare dependencies on this package.

To fix this problem, we can install more using the command below.

sudo apt-get -y install python-is-python3

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install python-is-python3.

sudo apt -y install python-is-python3

Or if you have aptitude installed you can use the following command.

sudo aptitude install python-is-python3

Summary

In this tutorial we learn how to fix python command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.