如何安装opencvforpython3.4?

2024-04-25 12:11:19 发布

您现在位置:Python中文网/ 问答频道 /正文


Tags: python
3条回答

这是非常简单的方法:

我建议通过水蟒使用。

在水蟒中创造环境(推荐一种): conda create -n deeplearning

然后,激活方式:activate deeplearning

现在,为Python3.x的python3.x安装opencv,如下所示:

  • conda install -c https://conda.binstar.org/menpo opencv3

    This will simply install opencv3 and other related libraries as: spicy, numpy, scikit-learn and matplotlib in that environment.

检查Opencv是否安装为:

>>> import cv2
>>> cv2.__version__
'3.1.0'

关于这个有很多教程和问题。

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.

{结束复制}

EDIT2:OpenCV不支持Python 3.x,除了opencv3.0版(仍处于测试阶段)。从下载站点下载3.0版本并尝试(感谢this question)。

A SO question with a possible tip, if the previous doesn't work.

最后,我将向您介绍如何安装它的read the docs tutorial

祝你好运!

conda install -c menpo opencv3

做到了。但是你必须安装水蟒。

相关问题 更多 >