无法通过 apt-get 安装 libopencv-dev

无法通过 apt-get 安装 libopencv-dev

我正在尝试libopencv-dev通过进行安装apt-get install。所以我运行了

sudo apt-get install libopencv-dev

并且它似乎安装了该软件包。但是,当我检查 lib 文件所在的目录时,我没有看到它们。

根据 dpkg,此目录是/usr/lib/x86_64-linux-gnu。但是 lib 文件既不在这里,也不在我的计算机上的其他地方。

我该如何解决这个问题?我已经尝试卸载并重新安装 libopencv-dev,但没有效果。

编译opencv c++程序出现以下错误:

g++: error: /usr/lib/x86_64-linux-gnu/libopencv_calib3d.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_contrib.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_core.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_features2d.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_flann.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_gpu.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_highgui.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_imgproc.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_legacy.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_ml.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_objdetect.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_ocl.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_photo.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_stitching.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_superres.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_ts.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_video.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_videostab.so: No such file or directory

我用来pkg-config --cflags --libs将 c++ 程序链接到 opencv 库。运行的输出 pkg-config --cflags --libs opencv是:

-I/usr/include/opencv /usr/lib/x86_64-linux-gnu/libopencv_calib3d.so -lopencv_calib3d /usr/lib/x86_64-linux-gnu/libopencv_contrib.so -lopencv_contrib /usr/lib/x86_64-linux-gnu/libopencv_core.so -lopencv_core /usr/lib/x86_64-linux-gnu/libopencv_features2d.so -lopencv_features2d /usr/lib/x86_64-linux-gnu/libopencv_flann.so -lopencv_flann /usr/lib/x86_64-linux-gnu/libopencv_gpu.so -lopencv_gpu /usr/lib/x86_64-linux-gnu/libopencv_highgui.so -lopencv_highgui /usr/lib/x86_64-linux-gnu/libopencv_imgproc.so -lopencv_imgproc /usr/lib/x86_64-linux-gnu/libopencv_legacy.so -lopencv_legacy /usr/lib/x86_64-linux-gnu/libopencv_ml.so -lopencv_ml /usr/lib/x86_64-linux-gnu/libopencv_objdetect.so -lopencv_objdetect /usr/lib/x86_64-linux-gnu/libopencv_ocl.so -lopencv_ocl /usr/lib/x86_64-linux-gnu/libopencv_photo.so -lopencv_photo /usr/lib/x86_64-linux-gnu/libopencv_stitching.so -lopencv_stitching /usr/lib/x86_64-linux-gnu/libopencv_superres.so -lopencv_superres /usr/lib/x86_64-linux-gnu/libopencv_ts.so -lopencv_ts /usr/lib/x86_64-linux-gnu/libopencv_video.so -lopencv_video /usr/lib/x86_64-linux-gnu/libopencv_videostab.so -lopencv_videostab

答案1

当你删除libopencv-dev一些没有被删除的 opencv lib 时,运行:

sudo apt list --installed | grep opencv

您可以检查某些库是否仍然存在并将其删除。然后您可以尝试重新安装 libopencv。
有帮助。

相关内容