我正在将opencv库用于Node,并且在Linux上遇到了一些奇怪的路径问题
仅发出require('opencv');
时,出现以下错误:
Error: libopencv_dnn.so.3.4: cannot open shared object file: No such file or directory
at Object.Module._extensions..node (internal/modules/cjs/loader.js:730:18)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
我看着binding.gyp,如果我执行find-opencv.js实用程序,我会得到似乎的答案:
/usr/src/app/node_modules/opencv# node utils/find-opencv.js --libs
-L/usr/local/lib -lopencv_dnn -lopencv_ml -lopencv_objdetect -lopencv_shape -lopencv_stitching -lopencv_superres -lopencv_videostab -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_video -lopencv_photo -lopencv_imgproc -lopencv_flann -lopencv_core
我可以在其中看到 opencv_dnn ,如果我ls
libs目录:
ls -l /usr/local/lib | grep dnn
lrwxrwxrwx 1 root root 20 Mar 20 17:23 libopencv_dnn.so -> libopencv_dnn.so.3.4
lrwxrwxrwx 1 root root 22 Mar 20 17:23 libopencv_dnn.so.3.4 -> libopencv_dnn.so.3.4.5
-rw-r--r-- 1 root root 12970608 Mar 20 17:20 libopencv_dnn.so.3.4.5
我看到 libopencv_dnn.so.3.4
确实存在。
不确定我下一步是什么...
答案 0 :(得分:0)
好的,因此运行ldconfig
似乎可以“解决”问题