/usr/bin/env: ‘python’: No such file or directory

I am trying to install Gitlab Development Kit on Windows Ubuntu Bash.

$python3 output

Python 3.5.2 (default, Nov 17 2016, 17:05:23)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

$python output

The program 'python' can be found in the following packages:
 * python-minimal
 * python3
Try: sudo apt install <selected package>

When I try to do this:

sudo apt-get install build-essential 
./configure 
make -j4 # adjust according to your available CPU capacity 
sudo make install

This is the output after ./configure

$ ./configure
/usr/bin/env: ‘python’: No such file or directory

$ python --version 

The program 'python' can be found in the following packages:
 * python-minimal
 * python3
Try: sudo apt install <selected package>

$which -a python

no output

How can I solve this? I am new to Ubuntu.


For ubuntu 20.04 you can use following package to python command. And it is python 3.

sudo apt-get install python-is-python3


Problem scenario:

/usr/bin/env: ‘python’: No such file or directory

Possible Solution #1

If Python 3 is not installed, install it: apt-get install python3

Possible Solution #2

If Python 3 has been installed, run these commands: whereis python3

Then we create a symlink to it: sudo ln -s /usr/bin/python3 /usr/bin/python


I had the same problem after installing Ubuntu 18.04 and trying to run some python scripts.

I tried:

sudo apt-get install python2.7-minimal

but I still got the same error. I solved it by:

sudo apt install python-minimal

You do seem to have python3 installed, but it isn't called python and anyway the script you want to run (configure) requires python 2. So:

  1. Install python2

    sudo apt-get install python2.7-minimal
    
  2. Run it again

    ./configure
    

If that fails again, call it with python2 explicitly:

/usr/bin/python2.7 configure

Yet Another Solution:

$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10
update-alternatives: using /usr/bin/python3 to provide /usr/bin/python (python) in auto mode

Tested & verified on my 20.04LTS system. See man update-alternatives for details. And, "No - it's not necessary to have Python2 installed for this to work."