In this article, we cover the error we recently got while executing an instruction set. The error we got was: /usr/bin/env: ‘python’: No such file or directory. Operating systems starting from Debian 11 (bullseye) and Ubuntu 20.04 LTS (focal) face this issue.
The Python packages use python2 and python3 as interpreters. And, they don’t use /usr/bin/python. So, when we execute a code, it doesn’t know where to look at. So, returns an error:
/usr/bin/env: ‘python’: No such file or directory
Open a terminal and issue the following:
python --version
This would return with:
Command 'python' not found, did you mean: command 'python3' from deb python3 command 'python' from deb python-is-python3
Note: Following operations require Administrative rights. If you don’t have one then contact your System Administrator for assistance.
Fixed: /usr/bin/env: ‘python’: No such file or directory
The easiest way to resolve the issue is by installing the package:
python-is-python3
It will create a symlink for /usr/bin/python to point at python3. For installing the package, we need to first update the repository. This ensures that we get to have the latest version of the package available. Open a terminal and issue the following:
sudo apt update
Next, install the package: python-is-python3
sudo apt install python-is-python3
When its installed, try running the python version command:
python --version
This time around you should Python3 version number in the standard output.
In conclusion, we have covered here how to fix the error: /usr/bin/env: ‘python’: No such file or directory.