How Python is Interpreted
Python is an interpreted language, not a compiled one.
In an interpreter, the execution of statements of code is done ‘one-by-one’. This means that when an error is encountered at the beginning of the code, the execution is stopped. But in the compiler, the code is executed entirely and all possible errors are listed at a time.
The python code you write is compiled into python bytecode, which creates file with extension .pyc. The bytecode compilation has happened internally, and almost completely hidden from the developer. Each of the source statements is translated into a group of byte code instructions. This byte code translation is performed to speed execution byte code can be run much quicker than the original source code statements.
The .pyc file, created in the compilation step, is then executed by appropriate virtual machines. The Virtual Machine is the runtime engine of Python, and it is always present as part of the Python system and is the component that truly runs the Python scripts. Technically, it’s just the last step of what is called the Python interpreter.