Super User is a question and answer site for computer enthusiasts and power users. 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

I use Bash on Windows, provided by MSYS.

I tried to run a Python file with a shebang of #!/usr/bin/env python, but I get this error message:

/usr/bin/env: python: No such file or directory

What can I do to make this work?

I know I can launch the Python file by suffixing it with python, but I want it to work without the suffix too.

share|improve this question

migrated from Jan 14 '12 at 23:56

This question came from our site for professional and enthusiast programmers.

Use the proper path where Python is installed instead, for example:


If you have Unix-like path support on your system (I'm not familiar with MSYS), you can always enter the path to your python executable, i.e. the output of which python.

share|improve this answer
Or you could use env, as the asker is doing. – Ignacio Vazquez-Abrams Jan 15 '12 at 0:07
I can't change the shebang, it's part of a project which involves other programmers that work on Linux and Mac. – Ram Rachum Jan 16 '12 at 11:25
@RamRachum What's the output of which env and which python and type python? – Daniel Beck Jan 16 '12 at 11:33

You might be interested in a Python Launcher For Windows

share|improve this answer

What happens when you run (from the shell):

$ /usr/bin/env python


If it starts an interactive python session, then python can be found. (You can also simply run: type python). If it prints "no such file or directory", then python isn't being found in your PATH. See if the following can be tweaked to fix the problem (spaces in the path/to/python will probably cause issues):

$ export PATH=$PATH:/path/to/python
$ /usr/bin/env python
share|improve this answer
up vote 0 down vote accepted

I turned out to be a mismatch between Virtualenv's file and MSYSGIT. It was never intended to work on Windows.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .