1

我在 Rpi 上安装了 Debian 操作系统。在安装 opencv 时,我在 "/home/pi/Opencv-2.4.3/release/lib" 中创建"opencv.pc"文件。然后我输入了以下两个命令:

  1. 须藤 gedit /etc/bash.bashrc

将以下两行添加到“bash.bashrc”文件并保存文件: PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/home/pi/Opencv-2.4.3/release/lib/pkgconfig export PKG_CONFIG_PATH

然后输入这些命令后出现以下错误:

  1. chmod +x build_all.sh

  2. /build_all.sh

解决办法是什么?

错误是..

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

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

contours.c:1:39: fatal error: opencv2/imgproc/imgproc_c.h: No such file or directory
compilation terminated.
compiling convert_cascade.c
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..etc..
4

1 回答 1

5

要将正确的路径添加到 bashrc,您可以执行以下步骤

  1. sudo find / -name "opencv.pc" -type f
  2. 注意1的目录输出。(没有文件名)
  3. 打开 /etc/bash.bashrc须藤 vi /etc/bash/bash.bashrc
  4. 查找并编辑或添加以下行

    PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/your/path/from/#1

    导出 PKG_CONFIG_PATH

  5. 保存你的文件:wq

  6. 注销并再次登录以激活更改
于 2013-07-24T18:48:44.193 回答