Glenn jackman's answer is correct, but I don’t have enough “reputation” to promote it, so I will post here. Your script is in Windows format, in which each line ends with a carriage return and line feed, and not just a line feed line. Many programs, including python, can handle any format without any problems. But when you run the script, the shell considers the carriage return to be part of the command name. Instead of running "/ usr / bin / env python", your shell tries to run "/ usr / bin / env python ^ M" (where ^ M is the line feed). You can say that this is because of the error message it gives you. Before “There is no such file or directory,” he prints the name of the program he was trying to execute. He also printed a translation line, which returned the cursor to the leftmost position in the line, which deleted everything before the colon.
If you do not have dos2unix, you can delete the lines with
tr -d '\r' < manage.py > manage2.py; mv manage2.py manage.py
You cannot read and write to the same file at the same time, so you should use a temporary file to store tr output.
Jonathan
source share