The difference between #!/usr/bin/env Python and #!/usr/bin/python

Source: Internet
Author: User

"Excerpt from: http://blog.csdn.net/wh_19910525/article/details/8040494"

The general Python file has a #!/usr/bin/python at the beginning. What does that mean?

#!/usr/bin/python tells the operating system to execute the script, invoking the Python interpreter under/usr/bin;
#!/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

The difference between #!/usr/bin/env Python and #!/usr/bin/python

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.