简体   繁体   中英

How do I install OpenCV for Python 3.4?

I use Python 3.4 through Anaconda distribution. They don't seem to have Python 3.4 bindings for OpenCV. I tried to use Cmake from the source, but to no avail. Could anybody please help me to install OpenCV for Python 3.4.x?

conda install -c menpo opencv3

Does the trick. However you have to have anaconda installed.

There are many tutorials and questions (on SO) about this.

This seems to answer your question. Edit : Reproduced below:

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 doesn't support Python 3.x except for OpenCV version 3.0 (still experimental, in beta). Download the 3.0 version from the download site and try that.(Thanks to this question ).

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

And finally, I will point you to a read the docs tutorial on how to install it.

Good luck!

This is Quite Simple way:

I recommend to use through anaconda.

Create the environment in anaconda(recommended one): conda create -n deeplearning

Then, activate by: activate deeplearning

Now, Install opencv for python3.x of Anaconda3 as:

  • 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.

Check whether Opencv installed or not as:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM