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

查看:55
本文介绍了使用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天全站免登陆