在pkg-config搜索路径中找不到软件包opencv [英] Package opencv was not found in the pkg-config search path
问题描述
我已按照 https://help.ubuntu.com/community/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 --cflags --libs opencv"时,出现此错误:
now when i execute "pkg-config --cflags --libs opencv" i get this error:
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
我该如何解决这个问题?
how can I resolve this problem?
------- UPDATE -------
好的,我想出了解决问题的方法...
OK, I figured out how to solve the problem...
我制作了一个名为"opencv.pc"的文件,并将其复制到"/usr/local/lib/pkgconfig" 然后我将这两行添加到".bashrc"中:
I made a file named "opencv.pc" and copied it to "/usr/local/lib/pkgconfig" Then i added these two lines to ".bashrc":
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
就是这样!一切都很好.
that's it! everything is OK now.
文件内容为:
prefix=/usr
exec_prefix=${prefix}
includedir=${prefix}/include
libdir=${exec_prefix}/lib
Name: opencv
Description: The opencv library
Version: 2.x.x
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 并执行它.
it seems that the ubuntu community has completed the documentation on installing openCV, all you have to do now is to download the installation script from https://github.com/jayrambhia/Install-OpenCV/blob/master/Ubuntu/opencv_latest.sh and execute it.
推荐答案
看来ubuntu社区已完成有关安装openCV的文档
it seems that the ubuntu community has completed the documentation on installing openCV,
so all you have to do now is to download the installation script from here and execute it.
别忘了使其可执行:
chmod +x opencv_latest.sh
然后
./opencv_latest.sh
这篇关于在pkg-config搜索路径中找不到软件包opencv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!