How Do You Resolve the “env: ‘python’: No such file or directory” Error without Installing Python 2?

Problem scenario
The security team for your enterprise will not permit Python 2 to be installed. (You do not want to install a new minimal Python package either.) How do you fix the problem of env: ‘python’: No such file or directory when you run a make command?

The command "python" (not python3), will work after you run this script. Run this script as sudo (e.g., sudo bash /tmp/

if [ -f "/usr/bin/python" ]
  echo "Python has been installed."
  pysource=$(which python)
  ln -s $pysource /usr/bin/python

Leave a comment

Your email address will not be published. Required fields are marked *