Home > Article > Backend Development > what is python interpreter
How do we let the computer read and execute Python code files? What is a python interpreter?
Python language is a programming language, a language that computers can understand.
The brain of the computer is the CPU, which is called the central processing unit in Chinese. It still cannot directly process the Python language.
CPU can only directly process machine instruction language, which is a language composed of 0 and 1 numbers, like the following,
This is a A language that is difficult for us humans to write directly.
So, we need a translator to translate the Python language into a machine instruction language that the computer CPU can understand, so that the computer can do things according to the requirements of our Python program.
Just like if you want an American to do something, and you only speak Chinese, then you need a Chinese translator who can speak English. You speak Chinese to the translator, and the translator listens. Now, speak English to the American and tell him what to do.
When the computer executes a Python program, this translation is the Python interpreter.
The Python interpreter itself is also a program. It interprets and executes Python code, so it is called an interpreter.
Without it, our Python code would have no way to run.
When we run a Python program, we first run the Python interpreter. Through this interpreter, we read our Python program file. The interpreter then tells the CPU how to do it in machine instruction language.
The principle is shown in the figure below:
So to run a Python program, you must have a Python interpreter.
Related recommendations: "Python Tutorial"
The above is the detailed content of what is python interpreter. For more information, please follow other related articles on the PHP Chinese website!