运行样例报错CMake Error at CMakeLists.txt:30 (find_package):......OpenCVConfig.cmake opencv-config.cmake.....
收藏回复举报
运行样例报错CMake Error at CMakeLists.txt:30 (find_package):......OpenCVConfig.cmake opencv-config.cmake.....
t('forum.solved') 已解决
发表于2024-04-17 16:27:21
0 查看

运行样例链接:

https://gitee.com/ascend/EdgeAndRobotics/tree/master/Samples/YOLOV5MultiInput

按照要求设置好环境变量:

export DDK_PATH=/usr/local/Ascend/ascend-toolkit/latest 
export NPU_HOST_LIB=$DDK_PATH/runtime/lib64/stub

安装好ACLLite仓库

下载模型、下载数据、模型转换:

cd model
wget https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/yolov5s/yolov5s_nms.onnx --no-check-certificate
wget https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/yolov5s/aipp.cfg --no-check-certificate
atc --model=yolov5s_nms.onnx --framework=5 --output=yolov5s_nms --input_shape="images:1,3,640,640;img_info:1,4"  --soc_version=Ascend310B4 --insert_op_conf=aipp.cfg
cd ../data 
wget https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/yolov5s/test.mp4 --no-check-certificate

编译样例源码时报错:

cd ../scripts 
bash sample_build.sh

在这一步报错:

CMake Error at CMakeLists.txt:30 (find_package):

  By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has                             

  asked CMake to find a package configuration file provided by "OpenCV", but                            

  CMake did not find one.                                                                               

   Could not find a package configuration file provided by "OpenCV" with any                             

  of the following names:            

                                                                   

    OpenCVConfig.cmake                                                                                  

    opencv-config.cmake               

                                                                  

   Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set                                   

  "OpenCV_DIR" to a directory containing one of the above files.  If "OpenCV"                           

  provides a separate development package or SDK, be sure it has been                                   

  installed.

在网络上查找资料,说需要重新安装下opencv库,实际上我已经使用

pip install opencv-python 命令安装好了opencv-python以及opencv-pythonheadless库

但是依旧报错,考虑以下链接方案重新安装opencv库:

https://blog.csdn.net/bj233/article/details/113351023

我的系统是Ubuntu20.04,在执行以上链接安装时在   二、环境配置这里,执行以下三条命令时报错:

命令:

sudo apt-get install build-essential

sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev

sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

执行第二条时报错:

The following packages have unmet dependencies:

 libgtk2.0-dev : Depends: libgtk2.0-0 (= 2.24.32-1ubuntu1) but 2.24.33-2ubuntu2 is to be installed

                 Depends: libglib2.0-dev (>= 2.27.3) but it is not going to be installed

                 Depends: libgdk-pixbuf2.0-dev (>= 2.21.0) but it is not going to be installed

                 Depends: libpango1.0-dev (>= 1.20) but it is not going to be installed

                 Depends: libatk1.0-dev (>= 1.29.2) but it is not going to be installed

                 Depends: libcairo2-dev (>= 1.6.4-6.1) but it is not going to be installed

                 Depends: libx11-dev (>= 2:1.0.0-6) but it is not going to be installed

                 Depends: libxext-dev (>= 1:1.0.1-2) but it is not going to be installed

                 Depends: libxinerama-dev (>= 1:1.0.1-4.1) but it is not going to be installed

                 Depends: libxi-dev (>= 1:1.0.1-4) but it is not going to be installed

                 Depends: libxrandr-dev (>= 2:1.2.99) but it is not going to be installed

                 Depends: libxcursor-dev but it is not going to be installed

                 Depends: libxfixes-dev (>= 1:3.0.0-3) but it is not going to be installed

                 Depends: libxcomposite-dev (>= 1:0.2.0-3) but it is not going to be installed

                 Depends: libxdamage-dev (>= 1:1.0.1-3) but it is not going to be installed

                 Recommends: python (>= 2.4) but it is not going to be installed

                 Recommends: debhelper but it is not going to be installed

E: Unable to correct problems, you have held broken packages.

目前也不知道究竟是哪里的问题。请求大佬们教教吧。

我要发帖子