在 pkg-config 搜索路径中找不到包 opencv [英] Package opencv was not found in the pkg-config search path

查看:123
本文介绍了在 pkg-config 搜索路径中找不到包 opencv的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经按照 https://help.ubuntu.com/community/OpenCV<中的说明安装了 OpenCV/a>

I have installed OpenCV using the instructions in 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?

-------更新-------

好的,我想出了如何解决这个问题...

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆