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\n
line endings, where \r
is carriage return and \n
is newline
That means that the first line might be like this
#!/usr/bin/env python\r\n
or
#!/usr/bin/python\r\n
so the shell is trying to run the command python\r
You're probably using the #!python
hashbang convention that's inexplicably popular among Windows users. Linux expects a full path there. Use either #!/usr/bin/python
or (preferably) #!/usr/bin/env python
instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With