Reprinted from: http://blog.csdn.net/wh_19910525/article/details/8040494
wh_19910525
The first line of the scripting language is to point out that you want the code in your file to run it with whatever executable program it is, so simple
#!/usr/bin/python is to tell the operating system to execute the script, call/usr/bin under the Python interpreter;
#!/usr/bin/env python is used to prevent operating system users from not loading Python into the default/usr/bin path. When the system sees this line, it will first find the Python installation path in the env settings, and then call the interpreter program under the corresponding path to complete the operation.
#!/usr/bin/python equivalent to writing dead python path;
#!/usr/bin/env Python will go to the environment settings to find the Python directory, recommend this writing
Here are some personal tips:
#!/usr/bin/env python # behind! There must be no spaces before, otherwise this sentence will be recognized as a comment
When the script is not recognized for execution with the Python interpreter, the system default script interpreter is used and an error is encountered.
For example:
Lnphonedemacbook-pro:desktop lnphone$./test.py. 5: syntax error near unexpected token ' ('5: ' width = input (') '
The difference between python--#!/usr/bin/env Python and #!/usr/bin/python--reprint