I'm creating this gist because it has taken me far too long to find information on how to build python into an executable via cython. There are two key pieces of information you need after installing cython and a compiler: (I'll use gcc for this example.)
- Compiler flags need to be linked via the
python3-configcommand. - The
python3-configcommand and thecythoncommand both need to be invoked with the--embedflag.
For this exercise, we'll start with a file called hello.py with the following contents:
print("Hello, World!")