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

Source: Internet
Author: User

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

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

Related Article

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.