CPU times: user 72.3 ms, sys: 8 µs, total: 72.3 ms Wall time: 72 ms print("Hello World") from distutils.core import setup from Cython.Build import cythonize setup( ext_modules=cythonize("helloworld.pyx") ) $ python3 setup.py build_ext --inplace >>> import helloworld Hello World def sum(x): total = 0 for i in range(x.shape[0]): total += x[i] return total $ gcc -fPIC -shared -o libsource.so source.c $ gcc -fPIC -shared -o libsum.so sum.c