尝试在python中构建opencv的问题:“-配置不完整,发生了错误" [英] Problems trying to build opencv in python: "-- Configuring incomplete, errors occurred"

查看:868
本文介绍了尝试在python中构建opencv的问题:“-配置不完整,发生了错误"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在python中安装openCV

I'm trying to install openCV in python

我有几个github和stackoverflow页面中提到的相同问题,但是我仍然被卡住:

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

github openCV问题#8382

github openCV问题#6027

github openCV问题#6066

这是终端的输出:

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$ 

推荐答案

对此

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

有效

然后我运行命令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 

为此,我创建了一个 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆