What is #!/usr/bin/env python?

Source: Internet
Author: User
Tags python script

#!/usr/bin/env python   This line of comments often appears in the first line of the Python script. What the hell does this line do for?
The reason is simple, and any Python script execution needs to rely on the Python interpreter.
This line of comments tells the computer where to find the Python interpreter. The purpose of the comment is to provide a path to find the Python interpreter.


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#!/usr/bin/env python
When you declare this, you will fetch the first python specified in the PATH of your machine to execute your script.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#!/usr/bin/python
This writing is dead, is to/usr/bin/python this directory python to execute your script. The portability of this program is poor. If the Python interpreter does not exist under this path, an error will be found.

What is #!/usr/bin/env 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.