How Do You Troubleshoot “/usr/bin/env: ‘python’: No such file or directory”?

Problem scenario
You try to run an AWS CLI command but you receive this error:
/usr/bin/env: ‘python’: No such file or directory

What should you do?

Possible Solution #1
If Python 3 is not installed, install it. You may want to see these postings:
How Do You Upgrade to Python 3.x on Ubuntu 16?
How Do You Upgrade Python 2.x to Python 3.7 in Debian or Ubuntu Linux?

Possible Solution #2
If Python 3 has been installed, run this command:
whereis python3
# If the above did not work, try this: sudo find / -name python3 -type f

Run a command like this, but substitute /path/to/python3 with one of the results in the above command (e.g., /usr/bin/python3).

sudo ln -s /path/to/python3 /usr/bin/python

That should be it. You should now try to run your Python command again.


If you want to purchase a book on Python, please see this link.

Join the Conversation

4 Comments

Leave a comment

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