There are two definitions of virtual machines, one is a system virtual machine similar to Vmware, and the other is a virtual machine called a program virtual machine, such as JVM and CLR are the most common virtual machines.
But python does not have its own dedicated virtual running PC (JRE) like java. python needs to have its own interpreter (such as: Cpython) to execute the bytecode one by one like a CPU. . Because Python is more of an interpreted language, while Java is more of a compiled language.
The concept of an interpreter is relatively simple. It can translate and run the code without compilation. The interpreter in the JVM is officially like this. What is interpreted in the JVM is the bytecode.
There are three ways for the interpreter to run a program:
1. Directly run a high-level programming language (such as the Shell's built-in interpreter)
2 , Convert high-level programming language code to some efficient bytecode (Bytecode), and run these bytecodes
3. Compile the high-level language with the compiler included in the interpreter, and instruct the processor to run the compilation The subsequent program (for example: JIT)
The above is the detailed content of What is a python virtual machine?. For more information, please follow other related articles on the PHP Chinese website!