How does cx_freeze compile a python script?

Does cx_freeze have its own compiler that comes from Python -> binary? Or does he translate it (for example, in C) and compile the translated code?

Edit: It seems to be compiled into bytecode. Does this mean that cx_freeze exe is just the binary part of the bytecode -> Python interpreter?

+4
source share
1 answer

cx_Freeze does not actually compile your code. It really just packs your Python code with the Python interpreter, so when you start the application, it sets up the Python interpreter and runs your Python code. It has the necessary technique to run from Python source code or bytecode, but it basically stores modules as bytecode because it loads faster.

Features like Cython and Nuitka go further: they translate your code into C and compile it into machine code, but they still use the Python VM machines. It just compiled code that invoked Python functionality, and not a virtual machine running Python bytecode.

+2
source

Source: https://habr.com/ru/post/1546230/


All Articles