我正在尝试使用此页面的OpenCV进行编译:Installing Darknet
[完成OPENCV = 1
之后,我尝试进行重新制作,所以我在darknet目录中进行了make
。
目录在下面。
(yolo) bash-3.2$ pwd
/Users/moray/darknet
(yolo) bash-3.2$ ls
LICENSE LICENSE.gpl LICENSE.v1 backup data libdarknet.a python src
LICENSE.fuck LICENSE.meta Makefile cfg examples libdarknet.so results
LICENSE.gen LICENSE.mit README.md darknet include obj scripts
重新制作的结果在这里。
(yolo) bash-3.2$ make
g++ -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv` -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -DOPENCV -c ./src/image_opencv.cpp -o obj/image_opencv.o
/bin/sh: pkg-config: command not found
./src/image_opencv.cpp:6:10: fatal error: 'opencv2/opencv.hpp' file not found
#include "opencv2/opencv.hpp"
^~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [obj/image_opencv.o] Error 1
所以我以为include路径不能引用opencv.hpp
,所以我寻找了文件并找到了它。
(yolo) bash-3.2$ ls ~/opt/anaconda3/pkgs/libopencv-3.4.2-h7c891bd_1/include/opencv2/opencv.hpp
/Users/moray/opt/anaconda3/pkgs/libopencv-3.4.2-h7c891bd_1/include/opencv2/opencv.hpp
因此我试图将#include "opencv2/opencv.hpp"
中的"include "~/opt/anaconda3/pkgs/libopencv-3.4.2-h7c891bd_1/include/opencv2/opencv.hpp"
更改为./src/image_opencv.cpp
结果在这里。
(yolo) bash-3.2$ make
g++ -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv` -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -DOPENCV -c ./src/image_opencv.cpp -o obj/image_opencv.o
/bin/sh: pkg-config: command not found
./src/image_opencv.cpp:7:10: fatal error:
'~/opt/anaconda3/pkgs/libopencv-3.4.2-h7c891bd_1/include/opencv2/opencv.hpp' file not found
#include "~/opt/anaconda3/pkgs/libopencv-3.4.2-h7c891bd_1/include/opencv2/opencv.hpp"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [obj/image_opencv.o] Error 1
我不明白为什么会发生错误。请告诉我您的想法。
============================================>
os:macOS Catalina 10.15.1
(yolo)是anaconda(3)中的虚拟环境
opencv是通过(yolo)中的pip命令安装的
[yolo]中所有通过pip命令的软件包:
(yolo) bash-3.2$ pip list Package Version --------------------- ------------------- certifi 2019.11.28 numpy 1.17.4 opencv-contrib-python 4.1.2.30 opencv-python 4.1.1.26 pip 19.3.1 setuptools 42.0.2.post20191203 wheel 0.33.6
gcc:
(yolo) bash-3.2$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.12)
Target: x86_64-apple-darwin19.0.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
我正在尝试使用此页面的OpenCV进行编译:安装Darknet在执行OPENCV = 1之后,我尝试进行重新制作,因此我在darknet目录中进行了制作。目录在下面。 (yolo)...
此错误将其解释为pkg-config: command not found
。为了在YOLO中使用OpenCV,您必须安装适用于C或C ++