: bad interpreter: No such file or directory in python [closed]

I originally coded in python IDE on windows. Now when I pasted my code in a file on Linux server. Now when I run the script, it gives me this error:

bad interpreter: No such file or directory

Please tell how to resolve this error.

Probably you have\r\nline endings, where\ris carriage return and\nis newline

That means that the first line might be like this

#!/usr/bin/env python\r\n



so the shell is trying to run the commandpython\r

You're probably using the#!pythonhashbang convention that's inexplicably popular among Windows users. Linux expects a full path there. Use either#!/usr/bin/pythonor (preferably)#!/usr/bin/env pythoninstead.

Tags: python
What Others Are Reading