#!/usr/local/bin/python
You are specifying the location to the python executable in your machine, that rest of the script needs to be interpreted with. You are pointing to python is located at /usr/local/bin/python
Consider the possiblities that in a different machine, python may be installed at /usr/bin/python or /bin/python in those cases, the above #! will fail. For those cases, we get to call the env executable with argument which will determine the arguments path by searching in the $PATH and use it correctly.
#/usr/bin/env python
We figure out the correct location of python ( /usr/bin/python or /bin/python from $PATH) and make that as the interpreter for rest of the script. ( env is almost always located in /usr/bin/ so one need not worry what is env is not present at /usr/bin)
No comments:
Post a Comment