1

I have python function, using numpy module. For example

import numpy as np

cdef public void test():
    x = np.linspace(-4, 4, shapness)

And i have main.c function, calling test function.

#include <Python.h>
#include "test.h"

int main (int argc, char **argv)
{
    printf ("Initializing Python Runtime...\n");
    Py_Initialize ();
    inittest();

    test();

    printf ("Cleanup...\n");
    Py_Finalize ();
    return 0;
}

I'm compiling all with cython

cython test.pyx -o test.c
gcc -o app main.c test.c `python-config --includes --ldflags`

When i'm running exe file, i'v got an error

Exception NameError: "name 'np' is not defined" in 'test.test' ignored

How i can compile all with numpy lib.

1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.