Python-python interpreter execution, python-python
Recently, due to the need of the company, I have been familiar with the magic language of python, which gives me the feeling that development is fast and the code is concise.
Let's start by listing the differences between the explanatory language and the compiled language. It's 0.0!
Compilation language:Before running the program, a special compilation process is required, such as generating exe and hex files.Specific machine language files. (Must be on a specific system ). So you canRun directly. However, this file cannot boast of the operating system platform, because it is not recognized in different operating systems.
Explanatory language:It does not need to be explained, but when the program is executed,Run a line to translate a line. Therefore, each execution must be explained.
Essential differences between the two
1. The running time is different:
Compile language is in the programBefore RunningCompile
Explanatory language in the programRuntimeExplanations
2 Portability:
Compilation languages can only run on specific machines and cannot be transplanted
Supports cross-platform operations using explanatory languages.
We know that some compilation languages, such as C and C ++, need to first compile and convert the source files into computer languages and form executable binary files through connectors, load these binary files into the memory for execution.
The running mode of an interpreted language is quite different from that of a compiled language. The explanatory language runs the program directly from the source code and executes the program in one sentence. How do they make the machine understand it? The interpreter corresponding to each interpreter language is used here. For example, the python interpreter directly converts the source code into bytecode, and then the interpreter executes these bytecode and converts the bytecode to the machine language. Then, the interpreter can run on the machine. These mechanisms give python the following features.
Because every execution must be converted to bytecode and then converted from a virtual machine to a machine language, the program performance will certainly be affected; it is easier for programmers to develop programs rather than program compilation and library links. Because python interpreters interact with the underlying machine, python code and the underlying machine become farther away, so python implements cross-platform.
Python provides a compilation method for performance issues. After compilation, you can get the pyc file and store the bytecode. Then, a special python interpreter is responsible for interpreting and executing the bytecode, this saves the interpreter the process of converting source code into bytecode, and saves the time for Loading modules, thus improving the execution efficiency, in addition, compiling to a pyc file also improves the code security to a certain extent.