Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Python2.7存在时使用miniconda安装OpenCV_Python_Opencv_Ubuntu - Fatal编程技术网

在Python2.7存在时使用miniconda安装OpenCV

在Python2.7存在时使用miniconda安装OpenCV,python,opencv,ubuntu,Python,Opencv,Ubuntu,我正试图在我的Ubuntu 14.04上安装OpenCV。我在usr/bin/python2.7中使用了Python 2.7。我试图编译OpenCV以使用我的miniconda python 3.6解释器,但它总是安装在我的python 2.7解释器上。我不知道怎么解决这个问题 这是我遵循的指南。以下是我运行的cmake命令: cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D I

我正试图在我的Ubuntu 14.04上安装OpenCV。我在
usr/bin/python2.7
中使用了Python 2.7。我试图编译OpenCV以使用我的miniconda python 3.6解释器,但它总是安装在我的python 2.7解释器上。我不知道怎么解决这个问题

这是我遵循的指南。以下是我运行的cmake命令:

cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D INSTALL_C_EXAMPLES=ON \
    -D INSTALL_PYTHON_EXAMPLES=ON \
    -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \
    -D BUILD_EXAMPLES=ON 
    -D PYTHON_DEFAULT_EXECUTABLE=$(which python3) ..
这是我运行它时得到的相关输出:

--   GUI: 
--     QT:                          NO
--     GTK+ 3.x:                    YES (ver 3.10.8)
--     GThread :                    YES (ver 2.40.2)
--     GtkGlExt:                    NO
--     OpenGL support:              NO
--     VTK support:                 NO
-- 
--   Media I/O: 
--     ZLib:                        /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.8)
--     JPEG:                        /usr/lib/x86_64-linux-gnu/libjpeg.so (ver )
--     WEBP:                        build (ver 0.3.1)
--     PNG:                         /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.2.50)
--     TIFF:                        build (ver 42 - 4.0.2)
--     JPEG 2000:                   /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1)
--     OpenEXR:                     /usr/lib/x86_64-linux-gnu/libImath.so /usr/lib/x86_64-linux-gnu/libIlmImf.so /usr/lib/x86_64-linux-gnu/libIex.so /usr/lib/x86_64-linux-gnu/libHalf.so /usr/lib/x86_64-linux-gnu/libIlmThread.so (ver 1.6.1)
--     GDAL:                        NO
-- 
--   Video I/O:
--     DC1394 1.x:                  NO
--     DC1394 2.x:                  YES (ver 2.2.1)
--     FFMPEG:                      YES
--       codec:                     YES (ver 54.35.1)
--       format:                    YES (ver 54.20.4)
--       util:                      YES (ver 52.3.0)
--       swscale:                   YES (ver 2.1.1)
--       resample:                  YES (ver 1.0.1)
--       gentoo-style:              YES
--     GStreamer:                   
--       base:                      YES (ver 1.2.4)
--       video:                     YES (ver 1.2.4)
--       app:                       YES (ver 1.2.4)
--       riff:                      YES (ver 1.2.4)
--       pbutils:                   YES (ver 1.2.4)
--     OpenNI:                      NO
--     OpenNI PrimeSensor Modules:  NO
--     OpenNI2:                     NO
--     PvAPI:                       NO
--     GigEVisionSDK:               NO
--     UniCap:                      NO
--     UniCap ucil:                 NO
--     V4L/V4L2:                    Using libv4l1 (ver 1.0.1) / libv4l2 (ver 1.0.1)
--     XIMEA:                       NO
--     Xine:                        NO
--     gPhoto2:                     NO
-- 
--   Other third-party libraries:
--     Use IPP:                     8.2.1 [8.2.1]
--          at:                     /home/tex/opencv/3rdparty/ippicv/unpack/ippicv_lnx
--     Use IPP Async:               NO
--     Use Eigen:                   YES (ver 3.2.0)
--     Use TBB:                     YES (ver 4.2 interface 7000)
--     Use OpenMP:                  NO
--     Use GCD                      NO
--     Use Concurrency              NO
--     Use C=:                      NO
--     Use pthreads for parallel for:
--                                  NO
--     Use Cuda:                    NO
--     Use OpenCL:                  YES
-- 
--   OpenCL:
--     Version:                     dynamic
--     Include path:                /home/tex/opencv/3rdparty/include/opencl/1.2
--     Use AMDFFT:                  NO
--     Use AMDBLAS:                 NO
-- 
--   Python 2:
--     Interpreter:                 /usr/bin/python2.7 (ver 2.7.6)
--     Libraries:                   /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.6)
--     numpy:                       /usr/local/lib/python2.7/dist-packages/numpy/core/include (ver 1.13.1)
--     packages path:               lib/python2.7/dist-packages
-- 
--   Python 3:
--     Interpreter:                 /home/tex/miniconda3/bin/python (ver 3.6.3)
--     Libraries:                   /home/tex/miniconda3/lib/libpython3.6m.so (ver 3.6.3)
--     numpy:                       /home/tex/miniconda3/lib/python3.6/site-packages/numpy/core/include (ver 1.13.3)
--     packages path:               /home/tex/miniconda3/lib/python3.6/site-packages
-- 
--   Python (for build):            /usr/bin/python2.7
-- 
--   Java:
--     ant:                         NO
--     JNI:                         /usr/lib/jvm/java-8-oracle/include /usr/lib/jvm/java-8-oracle/include/linux /usr/lib/jvm/java-8-oracle/include
--     Java wrappers:               NO
--     Java tests:                  NO
-- 
--   Matlab:
--     mex:                         NO
-- 
--   Documentation:
--     Doxygen:                     NO
--     PlantUML:                    NO
-- 
--   Tests and samples:
--     Tests:                       NO
--     Performance tests:           NO
--     C/C++ Examples:              YES
-- 
--   Install path:                  /usr/local
-- 
--   cvconfig.h is in:              /home/tex/opencv/build
-- -----------------------------------------------------------------
如何在miniconda上构建它


编辑:不是重复的,因为该命令
conda install opencv python
在不支持视频的情况下安装opencv,这是我需要的。

使用
gedit
并运行:

gedit ~/opencv/cmake/OpenCVDetectedPython.cmake
转到最后一行(表示if(PYTHON2INTERP_-FOUND)的if语句),并将整个if块更改为:

if(PYTHON3INTERP_FOUND)
    set(PYTHON_DEFAULT_AVAILABLE "TRUE")
    set(PYTHON_DEFAULT_EXECUTABLE "/home/tex/miniconda3/bin/python")
endif()

为我工作…

不,对不起,我正在安装带有视频支持的OpenCV-非常重要。以这种方式安装OpenCV不提供视频支持。这一个怎么样:?它不起作用:(出于某种原因,尽管它说解释器将是miniconda,但它实际上没有安装在那里