Why start script with /usr/bin/env python

I just downloaded a python script and noticed that the "shebang" line at the top looks like:

#!/usr/bin/env python

instead of the familiar

#!/usr/bin/python

What's the reason for that?


This is commonly used if the absolute path of the interpreter binary is not know or is assumed to be in different location from system to system. For python one could have an installation in /usr/local/ in addition to the ones installed by the distribution in /usr/. Without env in the shebang you would have to modify it to reflect your installation in /url/local/.