Python script execution under Linux

Source: Internet
Author: User

Suppose you have an existing Python script that you want to execute test.py

Python scripts are executed under Linux in two ways:

  1. Open Linux terminal, enter
    Python test.py

  2. Add a declaration to the first line of the test.py script
    #!/usr/bin/python

    This is the interpreter that specifies the Python script, and then adds executable permissions to test.py and executes

    chmod +x test.py. /test.py

    The first line adds executable permissions to test.py, and the second row executes the script. The meaning of (./) is in this directory

Python script execution under Linux

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.