Cannot link python libraries in deepstream makefile while embedding python in deepstream_app.c

Unable to import modules such as numpy, pandas etc. while embedding python code in C. I am using Jetson TX2 NX as development board with ubuntu18.04, deepstream sdk 6.0.1 and Jetpack 4.6.2. I have python 3.6.9 (python3 -V). Numpy is installed in /usr/lib/python3/dist-packages and also I have provided python library path in Makefile. I am attaching the snippet of Makefile below.

And below is the deepstream_app.c embedded code snippet
path - path where the python file is located
calculate_values - function in python file
f_num, l,w,t,h - parameters
char* path = “/home/jetsontx2/script”;
wchar_t* wpath = charToWChar(path);
PyObject* module = PyImport_ImportModule(“pyth”);
PyObject* function = PyObject_GetAttrString(module, “calculate_values”);
PyObject* args = PyTuple_New(5);
PyTuple_SetItem(args, 0, Py_BuildValue(“i”, f_num));
PyTuple_SetItem(args, 1, Py_BuildValue(“i”, l));
PyTuple_SetItem(args, 2, Py_BuildValue(“i”, t));
PyTuple_SetItem(args, 3, Py_BuildValue(“i”, w));
PyTuple_SetItem(args, 4, Py_BuildValue(“i”, h));
PyObject* result = PyObject_CallObject(function, args);
int value1, value2;
if (PyArg_ParseTuple(result, “ii”, &value1, &value2)) {
printf("(l + t): %d\n",value1);
printf("(w + h): %d\n", value2);
} else {
printf(“Failed to parse the result tuple.\n”);


  • I was able to run the same file using gcc without deepstream but I am not able to run in deepstream using make.