2nd. How Python Runs the program

Source: Internet
Author: User

2nd Chapter

How Python Runs the program

?

This chapter and the next chapter will take a quick look at the execution of the program-how you start the code, and how Python runs it. In this chapter, we'll look at how the Python interpreter executes the program. The 3rd chapter will show you how to build your own program and run it.

?

The startup details of a program are inherently relevant to a particular platform, and some of these chapters may not apply to the platform you're working on, so high-level readers should skip over the parts that are irrelevant to their intended use. Similarly, readers who have used similar tools in the past and expect fast-forward language may want to put some of these chapters on the shelf for future reference. For others, let's take a short look at how Python will run our code before learning how to write code.

?

Introducing the Python Interpreter

?

So far, I've mostly talked about python as a programming language. However, as far as the current implementation is concerned, it is also a package called an interpreter. An interpreter is a class of programs that are used to execute other programs. When you write a Python program, the Python interpreter reads your program and executes the instructions it contains. In fact, the interpreter is a layer of software logic between your code and the computer hardware of your machine.

?

When the Python package is installed on your machine, it generates several components-at least an interpreter and a support library. Depending on how you use it, the Python interpreter may behave as an executable or a set of libraries linked to another program. Depending on the kind of Python you run, the interpreter itself can be implemented as a C program, a set of Java classes, or something else. Whatever form you take, the Python code you write must be executed by the interpreter. And in order for the Python interpreter to execute your code, you must install the Python interpreter on your computer.

?

Python's installation details vary by platform and are covered in Appendix a more thoroughly. In short terms:

?

    • Windows users get and run a self-installing executable file to install Python on their machine. Simply double-click and follow the prompts to select Yes or next.
    • Linux and Mac OS x users may have preinstalled a usable python--on their computers today it is a standard component on these platforms.
    • Some Linux and Mac OS x users (and most UNIX users) compile Python from a full-scale source bundle of Python.
    • Linux users can also find RPM files, and Mac OS x users can find a variety of Mac-specific installation packages.
    • Other platforms have installation technologies associated with those platforms. For example, Python can be used for mobile phones, tablets, game consoles, and ipods, but the installation details vary widely.

?

Pythonitself can be from its primary sitehttp://www.python.orgdownload page to get it. It can also be found through a variety of other distribution channels. Keep in mind that the installationPythonbefore you should always check whether it already exists. If you are working inWindows 7and earlierWindowsversion, you will usually find it in the Start menuPython,2-1we will discuss the menu options shown here in the next chapter. In theUNIXand theLinuxon,Pythonmay exist in your/ usrthe directory tree.

?

2nd. How Python Runs the program

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.