Problems trying to build opencv in python: “― Configuring incomplete, errors occurred”

匿名 (未验证) 提交于 2019-12-03 01:23:02

问题:

I'm trying to install openCV in python

I have the same problem as mentioned in those several github and stackoverflow pages but I'm still stuck:

[github openCV issue #8382][1]

[github openCV issue #6027][2]

[github openCV issue #6066][3]

is it because the version of openCV and opencv_contrib do not match as mentionned here: [stackoverflow link][4]

Here is an ouput of the terminal:

mymacs-MacBook-Pro:build mymac$ cmake -D CMAKE_BUILD_TYPE=RELEASE \ >     -D CMAKE_INSTALL_PREFIX=/usr/local \ >     -D INSTALL_C_EXAMPLES=OFF \ >     -D INSTALL_PYTHON_EXAMPLES=ON \ >     -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \ >     -D BUILD_EXAMPLES=ON .. CMake Deprecation Warning at CMakeLists.txt:72 (cmake_policy):   The OLD behavior for policy CMP0022 will be removed from a future version   of CMake.    The cmake-policies(7) manual explains that the OLD behaviors of all   policies are deprecated and that a policy should be set to OLD only under   specific short-term circumstances.  Projects should be ported to the NEW   behavior and not rely on setting a policy to OLD.   CMake Deprecation Warning at CMakeLists.txt:77 (cmake_policy):   The OLD behavior for policy CMP0026 will be removed from a future version   of CMake.    The cmake-policies(7) manual explains that the OLD behaviors of all   policies are deprecated and that a policy should be set to OLD only under   specific short-term circumstances.  Projects should be ported to the NEW   behavior and not rely on setting a policy to OLD.   CMake Deprecation Warning at CMakeLists.txt:82 (cmake_policy):   The OLD behavior for policy CMP0042 will be removed from a future version   of CMake.    The cmake-policies(7) manual explains that the OLD behaviors of all   policies are deprecated and that a policy should be set to OLD only under   specific short-term circumstances.  Projects should be ported to the NEW   behavior and not rely on setting a policy to OLD.   -- Could NOT find GDAL (missing: GDAL_LIBRARY GDAL_INCLUDE_DIR)  -- Checking for module 'gstreamer-base-1.0' --   No package 'gstreamer-base-1.0' found -- Checking for module 'gstreamer-video-1.0' --   No package 'gstreamer-video-1.0' found -- Checking for module 'gstreamer-app-1.0' --   No package 'gstreamer-app-1.0' found -- Checking for module 'gstreamer-riff-1.0' --   No package 'gstreamer-riff-1.0' found -- Checking for module 'gstreamer-pbutils-1.0' --   No package 'gstreamer-pbutils-1.0' found -- Checking for module 'gstreamer-base-0.10' --   No package 'gstreamer-base-0.10' found -- Checking for module 'gstreamer-video-0.10' --   No package 'gstreamer-video-0.10' found -- Checking for module 'gstreamer-app-0.10' --   No package 'gstreamer-app-0.10' found -- Checking for module 'gstreamer-riff-0.10' --   No package 'gstreamer-riff-0.10' found -- Checking for module 'gstreamer-pbutils-0.10' --   No package 'gstreamer-pbutils-0.10' found -- Checking for module 'libv4l1' --   No package 'libv4l1' found -- Checking for module 'libv4l2' --   No package 'libv4l2' found -- Looking for linux/videodev.h -- Looking for linux/videodev.h - not found -- Looking for linux/videodev2.h -- Looking for linux/videodev2.h - not found -- Looking for sys/videoio.h -- Looking for sys/videoio.h - not found -- Checking for module 'libgphoto2' --   No package 'libgphoto2' found -- Found PythonInterp: /usr/local/bin/python2.7 (found suitable version "2.7.14", minimum required is "2.7")  -- Found PythonLibs: /usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/bin (found suitable exact version "2.7.14")  -- Found PythonInterp: /Users/mymac/.virtualenvs/cv/bin/python (found suitable version "3.5.4", minimum required is "3.4")  -- Found PythonLibs: /usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/config-3.5m/libpython3.5.dylib (Required is exact version "3.5.4")  -- Could NOT find Matlab (missing: MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN)  -- VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file -- Caffe:   NO -- Protobuf:   NO -- Glog:   NO CMake Error at /Users/mymac/opencv_contrib/modules/datasets/CMakeLists.txt:7 (ocv_append_source_files_cxx_compiler_options):   Unknown CMake command "ocv_append_source_files_cxx_compiler_options".   -- Configuring incomplete, errors occurred! See also "/Users/mymac/opencv/build/CMakeFiles/CMakeOutput.log". See also "/Users/mymac/opencv/build/CMakeFiles/CMakeError.log". mymacs-MacBook-Pro:build mymac$  

回答1:

As mentioned on this here I tried checkout the same version for opencv_contrib that I did for opencv by running the following command:

cd ~ cd opencv git checkout 3.0.0 cd ~ cd opencv_contrib git checkout 3.0.0 

It worked

I then ran the command make -j4

but the two following error messages appeared:

In file included from /Users/mymac/opencv_contrib/modules/cvv/src/gui/main_call_window.cpp:1: In file included from /Users/mymac/opencv_contrib/modules/cvv/src/gui/main_call_window.hpp:9: In file included from /Users/mymac/opencv_contrib/modules/cvv/src/gui/overview_panel.hpp:12:/Users/mymac/opencv_contrib/modules/cvv/src/gui/../stfl/stfl_engine.hpp:1056:30: error: use 'template' keyword to treat   'value' as a dependent template name             return settings.value(key).value<QStringList>();                                        ^                                        template   In file included from /Users/mymac/opencv_contrib/modules/cvv/src/controller/view_controller.cpp:12: In file included from /Users/mymac/opencv_contrib/modules/cvv/src/controller/../gui/overview_panel.hpp:12: /Users/mymac/opencv_contrib/modules/cvv/src/controller/../gui/../stfl/stfl_engine.hpp:1056:30: error: use 'template'   keyword to treat 'value' as a dependent template name             return settings.value(key).value<QStringList>();                                        ^                                        template  

For this i create a new question here



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!