Nuitka Beginner Tour

Dear Python beginner,

you are new to Python, and maybe new to compilers too. This tour shows you, without much jargon, what Nuitka can do for you and how to get started. If you get stuck at any point, there is a community of volunteers that is happy to help.

What is Nuitka

Nuitka is a compiler for Python programs. Normally, a Python program needs Python installed to run, and it runs directly from your source files. Nuitka translates your program into a real executable, like the programs you download from the internet, that runs on its own.

For you as a beginner, this has two nice effects:

  • Your program becomes faster.

  • You can give your program to other people, and they do not need Python at all.

Nuitka supports Python 3 (3.4 - 3.14) and Python 2 (2.6, 2.7).

First Steps

Install Nuitka:

python -m pip install -U Nuitka

Then check that it works:

python -m nuitka --version

Now take a small program, e.g. hello.py:

def main():
    print("Hello World")


if __name__ == "__main__":
    main()

Compile it:

python -m nuitka --mode=onefile hello.py

You now have a hello executable (hello.exe on Windows) next to your source file. Run it, and that is your program, compiled.

Note

The first compilation can take a while, because Nuitka uses a C compiler under the hood. The next ones will be much faster.

Getting Help