0

These are incomplete examples and are not helpful.

What is a minimal complete example. I mean something that produces a binary from a python script.

https://ron.sh/compiling-python-code-with-cython/

Making an executable in Cython

mathtick
  • 6,487
  • 13
  • 56
  • 101

1 Answers1

2

Here is an extremely simple example. I am peforming this from a Debian Sid workstation, using python3 and cython3..

Make sure you have python-dev or python3-dev packages installed beforehand.

1) Create a very simple Python program called hello.py

$ cat hello.py

print("Hello World!")

2) Use Cython to compile your python program into C...

cython3 --embed -o hello.c hello.py

3) Use GCC to compile hello.c into an executable file called hello...

gcc -Os -I /usr/include/python3.3m -o hello hello.c -lpython3.3m -lpthread -lm -lutil -ldl

4) You end up with a file called hello ...

Ujjwal Dash
  • 767
  • 1
  • 4
  • 8
  • Awesome. This works ... do you happen to know what needs to be included when important other libraries like pandas or anything else? I feel like I did this many years ago ... have another question on that detail now. – mathtick Jul 30 '20 at 10:44