在pkg-configsearchpath中找不到软件包opencv
我使用https://help.ubuntu.com/community/OpenCV中的说明安装了OpenCV
$ sudo su $ sudo apt-get install build-essential $ sudo apt-get install libavformat-dev $ sudo apt-get install ffmpeg $ sudo apt-get install libcv2.3 libcvaux2.3 libhighgui2.3 python-opencv opencv-doc libcv-dev libcvaux-dev libhighgui-dev
现在当我执行“pkg-config –cfalgs –libs opencv”我得到这个错误:
Package opencv was not found in the pkg-config search path. Perhaps you should add the directory containing `opencv.pc' to the PKG_CONFIG_PATH environment variable No package 'opencv' found
我该如何解决这个问题?
——- ——-更新
好,我想出了如何解决这个问题
我创build了一个名为“opencv.pc”的文件并将其复制到“/ usr / local / lib / pkgconfig”然后我将这两行添加到“.bashrc”中:
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig export PKG_CONFIG_PATH
而已! 一切都好了。
该文件的内容是:
prefix=/usr exec_prefix=${prefix} includedir=${prefix}/include libdir=${exec_prefix}/lib Name: opencv Description: The opencv library Version: 2.xx Cflags: -I${includedir}/opencv -I${includedir}/opencv2 Libs: -L${libdir} -lopencv_calib3d -lopencv_imgproc -lopencv_contrib -lopencv_legacy -lopencv_core -lopencv_ml -lopencv_features2d -lopencv_objdetect -lopencv_flann -lopencv_video -lopencv_highgui
更新 – 2014年
看来ubuntu社区已经完成了关于安装openCV的文档,现在你所要做的就是从https://github.com/jayrambhia/Install-OpenCV/blob/master/Ubuntu/opencv_latest.sh下载安装脚本并执行它。
从你的问题,我想你是使用Ubuntu(或派生)。 如果你使用:
apt-file search opencv.pc
那么你看到你必须安装libopencv-dev
。
在你这样做后, pkg-config --cflags opencv
和pkg-config --libs opencv
应该可以正常工作。
看来ubuntu社区已经完成了关于安装openCV的文档,
所以你现在要做的就是从这里下载安装脚本并执行它。
不要忘记让它可执行:
chmod +x opencv_latest.sh
然后
./opencv_latest.sh
嗨,首先,我希望你使用“新立得包pipe理器”。 你只需要到Ubuntu的软件中心,并寻找突触包pipe理器。这是美丽的是,所有你需要的软件包在这里很容易获得。 其次它会自动configuration你所有的path。 现在安装它,然后在那里searchopencv软件包,如果你find了绿色的软件包,然后安装它,否则软件包不在正确的地方,所以你需要重新安装它,但从包pipe理器这一次。 如果安装了,那么你只能这样做,你只需要用opencv的path填充OpenCV_DIRvariables(包含OpenCVConfig.cmake文件)
export OpenCV_DIR=<path_of_opencv>
$ ./configure --enable-libopencv ERROR: opencv not found using pkg-config $ cat /usr/lib64/pkgconfig/opencv.pc # Package Information for pkg-config prefix=/usr exec_prefix=${prefix} libdir=${exec_prefix}/lib64 includedir_old=${prefix}/include/opencv includedir_new=${prefix}/include Name: OpenCV Description: Open Source Computer Vision Library Version: 3.1.0 Libs: -L${exec_prefix}/lib64 -lopencv_shape -lopencv_stitching -lopencv_superres -lopencv_videostab -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_cvv -lopencv_dnn -lopencv_dpm -lopencv_fuzzy -lopencv_hdf -lopencv_line_descriptor -lopencv_optflow -lopencv_plot -lopencv_reg -lopencv_saliency -lopencv_stereo -lopencv_structured_light -lopencv_rgbd -lopencv_surface_matching -lopencv_tracking -lopencv_datasets -lopencv_text -lopencv_face -lopencv_video -lopencv_ximgproc -lopencv_calib3d -lopencv_features2d -lopencv_flann -lopencv_xobjdetect -lopencv_objdetect -lopencv_ml -lopencv_xphoto -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_photo -lopencv_imgproc -lopencv_core Libs.private: -L/usr/lib64 -lQt5Test -lQt5Concurrent -lQt5OpenGL -L/lib64 -lwebp -lpng -ltiff -ljasper -ljpeg -lImath -lIlmImf -lIex -lHalf -lIlmThread -lgdal -lgstvideo-1.0 -lgstapp-1.0 -lgstbase-1.0 -lgstriff-1.0 -lgstpbutils-1.0 -lgstreamer-1.0 -lucil -lunicap -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lfontconfig -lfreetype -lglib-2.0 -ldc1394 -lv4l1 -lv4l2 -lgphoto2 -lgphoto2_port -lexif -lQt5Core -lQt5Gui -lQt5Widgets -lhdf5_hl -lhdf5 -lz -ldl -lm -ltesseract -llept -lpthread -lrt -lGLU -lGL Cflags: -I${includedir_old} -I${includedir_new} $ pkg-config --cflags --libs opencv -I/usr/include/opencv -lopencv_shape -lopencv_stitching -lopencv_superres -lopencv_videostab -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_cvv -lopencv_dnn -lopencv_dpm -lopencv_fuzzy -lopencv_hdf -lopencv_line_descriptor -lopencv_optflow -lopencv_plot -lopencv_reg -lopencv_saliency -lopencv_stereo -lopencv_structured_light -lopencv_rgbd -lopencv_surface_matching -lopencv_tracking -lopencv_datasets -lopencv_text -lopencv_face -lopencv_video -lopencv_ximgproc -lopencv_calib3d -lopencv_features2d -lopencv_flann -lopencv_xobjdetect -lopencv_objdetect -lopencv_ml -lopencv_xphoto -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_photo -lopencv_imgproc -lopencv_core $ uname -a Linux fedora-23-x64 4.8.13-100.fc23.x86_64 #1 SMP Fri Dec 9 14:51:40 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux