Boolean numpy arrays with Cython
问题 I have a numpy boolean array: myarr = np.array([[False, True], [True, False]]) If I try to initialise a Cython MemoryView with it, like this: cdef bint[:,:] mymem = myarr I get this error: ValueError: Does not understand character buffer dtype format string ('?') If I do this instead, it works fine: cdef np.int_t[:,:] mymem = np.int_(myarr) How can I store a boolean numpy array using Cython MemoryViews? 回答1: I ran into the same problem some time ago. Unfortunately I did not find a direct