7

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?

5
  • What happened when you tried compiling? Commented Feb 5, 2015 at 22:18
  • When I ran the CMake utility, I got an error saying something is missing in the CMakelists.txt file in the OpenCV/source folder? Commented Feb 6, 2015 at 3:26
  • Hi , I got to the point of compiling and generating a build for Python 3.x. But I don't know how to proceed from here. How do I get the cv2 module working in Python 3.x Commented Feb 6, 2015 at 19:52
  • see also stackoverflow.com/questions/20953273/… Commented Feb 13, 2015 at 9:28
  • I am using Windows 7, 64-bit. The solution provided are for Linux and OS X. Commented Feb 13, 2015 at 19:41

3 Answers 3

8
conda install -c menpo opencv3

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

Sign up to request clarification or add additional context in comments.

Comments

3

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!

9 Comments

I don't understand much from this website. Can you please tell me step-by-step how to install from the source if compatible binaries aren't already available?
Yes, I did that but I got the following error in Python-3.4:ImportError: DLL load failed: The specified module could not be found.
The cv2.pyd under Python 2.7 is not compatible with Python 3.4
I installed the OpenCV version 3.0 beta, it still gives t he same error: ImportError: DLL load failed: The specified module could not be found.
Hi, I built OpenCV for Python 3.4 using CMake and MingW. It builds successfully, but I don't know what to do from here. How do I get the OpenCV module in the lib/site-packages folder in Python? import cv2 doesn't work. Any help would be much appreciated.
|
0

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'

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.