If you are running python code on Linux or MacOs operating system then you might get the error “/usr/bin/env: ‘python’: No such file or directory”.If yes then this post is for you. In this tutorial, you will learn how to solve this issue differently.
What causes usr bin env python no such file or directory Error?
Suppose you are configuring the python by typing the command “./configure” on your terminal of MacOS or Linx OS then you may get the error like the below.
/usr/bin/env: ‘python’: No such file or directory
To solve this error you have to follow the solutions in the next section.
Solution for the usr bin env python no such file or directory
Solution 1: Install python
The first solution is to install the python package in your system. Open your terminal and type the following command to install it. sudo apt-get update sudo apt-get install python3
It will solve the error.
Solution 2: Create a link to the python
The second solution is to create a symlink or link to python. This solution will work when python 3. xx is already installed in your system as you have to check where the python is installed.
Now create a symlink for the directory.
sudo ln -s /usr/bin/python3 /usr/bin/python
Now again use the ./configure you will not get the ‘python’: No such file or directory error.
Solution 3: Install the minimal version of python
If the above two solutions do not solve this error then you can follow this solution. Here you have to install the minimal version of python in your system.
Open your terminal and type the command below.
sudo apt-get install python-minimal
Now you will not get the error.
In Linux or macOS operating system you mostly get this python No such file or directory. The general solution for this is to install the python library. If it is not solved then try the other solutions.
If you are unable to solve this error then you can contact us for more solutions.