cython Cython bundling Adding Numpy to the bundle

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!


To add Numpy to the bundle, modify the with include_dirs keyword and necessary import the numpy in the wrapper Python script to notify Pyinstaller.


import numpy as np
cimport numpy as np

def do_stuff():
    print("Hello World!")
    cdef int n
    n = 2
    r = np.random.randint(1,5)
    print("A random number: "+str(r))
    print("A random number multiplied by 2 (made by cdef):"+str(r*n))
    input("Press Enter to continue.")

from distutils.core import setup, Extension
from Cython.Build import cythonize
import numpy


import program
import numpy

Got any cython Question?