https://cloud.tencent.com/developer/article/1657529
(!!
注意:
conda deactivate 否则 conda 环境会和之前冲突 https://zhuanlan.zhihu.com/p/504272628
Cmake 可能也会有影响,我这里安装opencv4.8 使用cmake3.23
其他:https://www.cnblogs.com/llfctt/p/9122137.html
!!)
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
这是因为在虚拟环境中无法找到 opencv.pc
需要复制到虚拟环境的检索目录中,我的做法是:
其中opencv4.pc就在install的目录中
1981 cd ~/anaconda3/envs/NeuS/lib/pkgconfig/
1988 sudo cp ~/opencv_build/opencv/build/unix-install/opencv4.pc ./opencv.pc
不在虚拟环境中的解决方法如下:https://cloud.tencent.com/developer/ask/sof/139905
还有一个个github issue 也提到了这个问题https://github.com/pjreddie/darknet/issues/2376
想深入了解原理的可以看这篇博客 https://www.modb.pro/db/175174
参考:https://www.jianshu.com/p/e0c8f771d4a6
主要问题是 /usr/local/include 文件夹中的结构是 include/opencv4/opencv2,
把 opencv2 创建一个软链接到父目录即可。
cd /usr/local/include/
sudo ln -s opencv4/opencv2 opencv2
# Install libs:
sudo apt-get install libopencv-highgui-dev
# search for installed file
find /usr | grep libopencv_highgui.so.408