Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

python compiler

Zeioth edited this pageJul 12, 2023 ·5 revisions

Python is treated the same way we treat the other compilers. With one big particularity. Python can be:

  • Interpreted
  • Compiled to machine code
  • Compiled to bytecode

In this section I will describe how we do it internally.

Interpreted

This is how you would normally run a python program:

# Internally we dopython main.py

Compiled to machine code

We use nuitka to compile the program to machine code. What nuitka does, is to convert your code to C and compile it. This means your program can run even if the computer doesn't have a python interpreter. This way of compiling offers the maximum performance.

# Internally we donuitka main.py

The way of running the resulting program is just

./bin/program

Compiled to bytecode

We use the toolpythoninstall to convert the program to bytecode. This means your program can run in any machine that has the python interpreter, with a performance close to machine code. This way of compiling offers a portability as good as interpreted python, with a performance close to machine code. (Similar to a java/C# program).

# Internally we dopyinstaller main.py

Again, the way of running the resulting program is just:

./bin/program

Misc. considerations

Note that if you pass parameters in your.solution file, you are targeting only one type of compilation (as every type of compilation use a different compiler). If you want to do crazy stuff like performing all types of compilation at the same time, fork the project and write your own python backend.

Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp