添加正确的PKG_CONFIG_PATH后仍未找到 Opencv 包 [已关闭]

Opencv package not found even after adding the correct PKG_CONFIG_PATH [closed]

提问人:Yap Wei Cheng 提问时间:11/17/2023 最后编辑:Christoph RackwitzYap Wei Cheng 更新时间:11/18/2023 访问量:30

问:


编辑问题以包括所需的行为、特定问题或错误以及重现问题所需的最短代码。这将帮助其他人回答这个问题。

5天前关闭。

社群在 5 天前审查了是否重新打开这个问题,并将其关闭:

原始关闭原因未解决

yapch@ywc:~$ echo PKG_CONFIG_PATH=$PKG_CONFIG_PATH
PKG_CONFIG_PATH=
yapch@ywc:~$ echo PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
yapch@ywc:~$ export  PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
yapch@ywc:~$ export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
yapch@ywc:~$ echo PKG_CONFIG_PATH=$PKG_CONFIG_PATH
PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
yapch@ywc:~$ cd /usr/lib/x86_64-linux-gnu/pkgconfig
yapch@ywc:/usr/lib/x86_64-linux-gnu/pkgconfig$ ls
IlmBase.pc     libavformat.pc  libdeflate.pc       libjpeg.pc  libpng16.pc       libtiff-4.pc  python-3.10-embed.pc  tbb.pc
OpenEXR.pc     libavutil.pc    libexif.pc          liblzma.pc  libraw1394.pc     libtirpc.pc   python-3.10.pc        zlib.pc
expat.pc       libcrypt.pc     libgphoto2.pc       libnsl.pc   libswresample.pc  libxcrypt.pc  python3-embed.pc
libavcodec.pc  libdc1394-2.pc  libgphoto2_port.pc  libpng.pc   libswscale.pc     opencv4.pc    python3.pc
yapch@ywc:/usr/lib/x86_64-linux-gnu/pkgconfig$ cd ~
yapch@ywc:~$ cd yolo/darknet/
yapch@ywc:~/yolo/darknet$ make
nvcc  -gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52] -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda-12.3/include/ --compiler-options "-Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -DOPENCV -DGPU" --compiler-options "-std=c++11" -c ./src/convolutional_kernels.cu -o obj/convolutional_kernels.o
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 pkg-配置

评论


答:

1赞 Allan Wind 11/17/2023 #1

pkg-config 文件是根据您的输出调用的,因此请将 Makefile 更改为 .如果它被定义为变量,则可以在命令行上覆盖它。opencv4.pclspkg-config --cflags opencv4

评论

0赞 Allan Wind 11/19/2023
如果我回答了您的问题,请点击旁边的复选标记接受它。