when i install opencv4.1.0,and i got this.so how can i fix it?thanks

[100%] Linking CXX shared module …/…/lib/python3/cv2.cpython-36m-aarch64-linux-gnu.so
/media/johnwatson/DeepSpace/JetsonNano/opencv-4.1.0/modules/python/src2/cv2.cpp:39:10: fatal error: numpy/ndarrayobject.h: No such file or directory
#include <numpy/ndarrayobject.h>
compilation terminated.
modules/python2/CMakeFiles/opencv_python2.dir/build.make:62: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir//src2/cv2.cpp.o’ failed
make[2]: *** [modules/python2/CMakeFiles/opencv_python2.dir/
/src2/cv2.cpp.o] Error 1
CMakeFiles/Makefile2:10724: recipe for target ‘modules/python2/CMakeFiles/opencv_python2.dir/all’ failed
make[1]: *** [modules/python2/CMakeFiles/opencv_python2.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs…
[100%] Built target opencv_python3
Makefile:162: recipe for target ‘all’ failed
make: *** [all] Error 2

It looks like you are missing a Numpy development package(s). The odd thing is that should have been checked for when you ran cmake.

How are you building OpenCV 4.1.0, specifically? From an archive, git, a script? which?

In any case, you may try this command to give you the necessary build dependencies to get past that particular error (if that is causing it):

sudo apt-get install -y python-dev python-numpy python3-dev python3-numpy

This script will do that automatically.


pip3 install numpy

that for example you could run from under virtual environment
you may as well need to verify with cmake output that numpy path is correct, and if it is not you might need to remove the build folder and recreate it.
Moreover, you could pass the parameter to cmake as: