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

This error often occurs due to an issue with line endings when a file created or edited on a Windows system is used in a Unix-like environment. To fix it, you can use a command like dos2unix to convert line endings to Unix format.

Install dos2unix if you haven't already:

sudo apt-get install dos2unix

Then use it to convert your file:

dos2unix your_script.py

This command will convert the line endings in the file your_script.py from DOS/Windows format to Unix format, which should resolve the issue.