使用 anaconda python3 安装 opencv 3.1? [英] Installing opencv 3.1 with anaconda python3?

查看:45
本文介绍了使用 anaconda python3 安装 opencv 3.1?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何使用 anaconda python3 安装 opencv,opencv 获取了我的 python3 可执行文件

How do I install opencv with anaconda python3 , opencv picked up my python3 executables

--   Python 2:
--     Interpreter:                 /usr/bin/python2.7 (ver 2.7.12)
--     Libraries:                   /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.12)
--     numpy:                       /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.11.0)
--     packages path:               lib/python2.7/dist-packages
-- 
--   Python 3:
--     Interpreter:                 /home/tamim/anaconda3/bin/python3 (ver 3.5.2)
--     Libraries:                   /usr/lib/x86_64-linux-gnu/libpython3.5m.so (ver 3.5.2)
--     numpy:                       /home/tamim/anaconda3/lib/python3.5/site-packages/numpy/core/include (ver 1.11.1)
--     packages path:               lib/python3.5/site-packages
-- 
--   Python (for build):            /usr/bin/python2.7

我使用以下 make 选项安装了 opencv

I installed opencv with the following make options

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D WITH_CUBLAS=1 -D CUDA_NVCC_FLAGS="-D_FORCE_INLINES" ..

但是安装后我无法在anaconda的python3中导入cv2.但是,我可以从内置的 python2 命令导入 cv2.所以我想它是为 python2 版本构建的,如最后一行所述.

But after installing it I can't import cv2 within python3 of anaconda. I can however import cv2 from builtin python2 command. So I suppose it build for the python2 version as stated in the last line.

我如何为 anaconda python3 构建?

How do I build for anaconda python3 ?

推荐答案

我觉得你不需要为 anaconda 构建 OpenCV,有这个很方便安装后可在终端中使用的名为conda"的工具Anaconda python 发行版.

I think you don't need to build OpenCV for anaconda, there is this very handy tool called 'conda' that is available in your terminal once you have installed the Anaconda python distribution.

我发现这个网站提供了关于如何安装 opencv3 的说明

I found this site which gives instruction on how to install opencv3

https://anaconda.org/menpo/opencv3

我亲自安装了它,所以请尝试按照这些说明进行操作.

I personally installed it myself so just try follow along with these instructions.

如果您的系统中安装了 Anaconda python 发行版,您可以发出以下命令(假设您在 linux 上工作)启动终端:

If you have the Anaconda python distribution installed in your system, you can issue this command (assuming you are working on linux) fire up the terminal:

conda install -c menpo opencv

如果你的Anaconda安装的python版本是2.7,上面的命令应该安装OpenCV 3.1,但是如果你的python版本是3.5,那么你应该把最后一行的'opencv'改成'opencv3'

If the version of python install in your Anaconda is 2.7, the command above should install OpenCV 3.1, but if the version of your python is 3.5, then you should change 'opencv' in the last line to 'opencv3'

conda install -c menpo opencv3

这应该在你的 Anaconda 中安装 OpenCV.要查看您是否已成功安装它,请启动您的 Python 并发出以下命令:

This should install OpenCV in your Anaconda. To see if you have installed it successfully, fire up your Python and issue the following command:

import cv2 # import the opencv library

cv2.__version__ # this will print the version of your opencv3

希望有帮助 =)

这篇关于使用 anaconda python3 安装 opencv 3.1?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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