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?
-
What happened when you tried compiling? – Padraic Cunningham Feb 05 '15 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? – user3317287 Feb 06 '15 at 03: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 – user3317287 Feb 06 '15 at 19:52
-
see also http://stackoverflow.com/questions/20953273/install-opencv-for-python-3-3 – NoDataDumpNoContribution Feb 13 '15 at 09:28
-
I am using Windows 7, 64-bit. The solution provided are for Linux and OS X. – user3317287 Feb 13 '15 at 19:41
3 Answers
conda install -c menpo opencv3
Does the trick. However you have to have anaconda installed.

- 159
- 2
- 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!

- 1,298
- 12
- 28
-
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? – user3317287 Feb 06 '15 at 03:27
-
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. – user3317287 Feb 06 '15 at 04:01
-
-
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. – user3317287 Feb 06 '15 at 05:10
-
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. – user3317287 Feb 06 '15 at 19:47
-
This is where things are murky, since this was just released. My suggestion would be to try following the steps that I had pasted above. Start with step 2. Also, make *absolutely* sure that the bitness (x86 vs x64) is the same as your python version. – IronManMark20 Feb 06 '15 at 22:16
-
There is no folder from where I can extract cv2.pyd. I can't imagine there is not straightforward steps to install OpenCV for Python-3.x – user3317287 Feb 06 '15 at 22:42
-
As I mentioned, Python 3.x wasn't supported until recently. I am downloading the newest release now, I'll let you know what I find. – IronManMark20 Feb 06 '15 at 22:54
-
No .download failed after an hour. I'll try again later today. I read [this](http://opencv.org/wp-content/uploads/2013/icvs/ICVS2013%20-%20OpenCV%203.0.pdf) which implies the Python related things are in "modules" try looking for that. If you do find it, try adding the directory the Python scripts are in to your PATH. – IronManMark20 Feb 07 '15 at 15:35
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'

- 3,500
- 1
- 23
- 30