Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Lubuntu Raring Ringtail. I want to be able to execute my scripts with ./

I start my python script with #!/usr/bin/python and it says

bash : ./ /usr/bin/python^M: bad interpreter: No such file or directory

If I use #!/usr/bin/env python it gives a similar error:

: No such file or directory

What am I doing wrong?

I absolutely have python installed, and can run the scripts as normal with python

share|improve this question
Have you taken a look at this question:… ? – Alvin Row Aug 16 '13 at 4:27
up vote 7 down vote accepted

From the ^M you can see that the file is using windows/dos-style line breaks (Windows uses CR LF (carriage return + line feed) at the end of a line. Unix only uses LF - so what you see as ^M is the CR. So what you are not using /usr/bin/python but /usr/bin/python<CR> that does not exist.

You can remove the ^M using dos2unix (do a sudo apt-get install dos2unix to install and then use dos2unix

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.