我通过Anaconda发行版使用Python 3.4。他们似乎没有为OpenCV提供Python 3.4绑定。我尝试从源头使用Cmake,但无济于事。 有人可以帮我安装OpenCV for Python 3.4.x吗?
答案 0 :(得分:8)
conda install -c menpo opencv3
诀窍。但是你必须安装anaconda。
答案 1 :(得分:3)
关于此,有许多教程和问题(关于SO)。
This似乎回答了你的问题。 修改:转载如下:
1) Download OpenCV from http://opencv.org/downloads.html and extract
2)From the extracted folder, copy the file from the extracted directory:
opencv/build/python/2.7/(either x86 or x64, depending on your Anaconda
version)/cv2.pyd to your Anaconda site-packages directory, e.g.,
C:\Anaconda\Lib\site-packages
3)To get ffmpeg within opencv to work, you'll have to add the directory
that ffmpeg is located in to the path (e.g., opencv/sources/3rdparty
/ffmpeg). Then you'll have to find the dll in that folder (e.g.,
opencv_ffmpeg_64.dll) and copy or rename it to a filename that includes
the opencv version you are installing, (e.g., opencv_ffmpeg249_64) for
2.4.9.
{End Reproduction}
EDIT2 :OpenCV不支持Python 3.x,但OpenCV 3.0版除外(仍为实验版,测试版)。从下载站点下载3.0版本并试试。(感谢this question)。
A SO question with a possible tip, if the previous doesn't work.
最后,我将指出你如何安装read the docs tutorial。
答案 2 :(得分:0)
这是非常简单的方法:
我建议通过anaconda使用。
在anaconda中创建环境(推荐一个):
conda create -n deeplearning
然后通过以下方式激活:activate deeplearning
现在,为Anaconda3的python3.x安装opencv:
conda install -c https://conda.binstar.org/menpo opencv3
这将简单地在该环境中安装opencv3和其他相关库,例如:辣,numpy,scikit-learn和matplotlib。
检查Opencv是否按以下方式安装:
>>> import cv2
>>> cv2.__version__
'3.1.0'