Package opencv was not found in the pkg-config search path.

Ubuntu里配置opencv时,最后一步报错为:
Package opencv was not found in the pkg-config search path.
解决方法如下:

cd /usr/local/lib

sudo mkdir pkgconfig
cd pkgconfig
sudo touch opencv.pc
sudo vim opencv.pc


首先建一个新的文件夹:pkgconfig
然后cd到这个文件夹下,新建opencv.pc文件;
再打开opencv.pc文件,文件内输入:

prefix=/usr/local
exec_prefix=${prefix}
includedir=${prefix}/include
libdir=${exec_prefix}/lib

Name: opencv
Description: The opencv library
Version:4.1.2
Cflags: -I${includedir}/opencv4
Libs: -L${libdir} -lopencv_shape -lopencv_stitching -lopencv_objdetect -lopencv_superres -lopencv_videostab -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_video -lopencv_photo -lopencv_ml -lopencv_imgproc -lopencv_flann  -lopencv_core

编译darknet时,lopencv_shape、lopencv_superres、lopencv_videostab删除,目录下不存在此项
其中version是你的opencv版本。
最后:wq保存退出。
posted @ 2021-12-30 14:35  wuyuan2011woaini  阅读(1267)  评论(0编辑  收藏  举报