Ask Your Question

OpenCV-Python build problem in Windows with Master branch

asked 2013-09-01 00:43:36 -0500

Abid Rahman K gravatar image

updated 2013-09-05 00:21:14 -0500


I am trying to build OpenCV master branch with Visual Studio 2010 and Python support. But CMake always shows:

Could NOT find PythonLibs (missing: PYTHON_INCLUDE_DIRS) (Required is exact version "2.7.3")

So python is disabled automatically. Below image shows Python fields in Cmake gui.

image description

All fields are filled here. And I couldn't find a field with PYTHON_INCLUDE_DIRS anywhere. Also, BUILD_opencv_python is also missing.

So what goes wrong here?

edit retag flag offensive close merge delete



had a similar problem yesterday, after updating my local master branch, there was PYTHON_NUMPY_INCLUDE_DIR as well as PYTHON_NUMPY_INCLUDE_DIRS.

deleting CmakeCache.txt ( even the whole build folder ) solved it for me.

berak gravatar imageberak ( 2013-09-01 03:13:49 -0500 )edit

Thank you, I will update and check it.

Abid Rahman K gravatar imageAbid Rahman K ( 2013-09-01 05:27:40 -0500 )edit

I updated, but it is still the same. Any idea.

Abid Rahman K gravatar imageAbid Rahman K ( 2013-09-01 23:12:06 -0500 )edit

In my case, even the option BUILD_opencv_python is not there.

Abid Rahman K gravatar imageAbid Rahman K ( 2013-09-03 09:07:23 -0500 )edit

bwaa. no idea.

cleanup & another git pull maybe ?

berak gravatar imageberak ( 2013-09-03 09:19:07 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-09-05 00:36:05 -0500

Abid Rahman K gravatar image

So after a little bit of headaches, it worked for me :). Below is summary of what I did.

  1. A new git clone of the official OpenCV repo. (as mentioned by @berak in his comments) (It didn't make any change).
  2. Used Visual Studio 2012 (instead of 2010).
  3. Reinstalled Python and Numpy.


I tried building with 2.4 branch. It worked fine. So I thought problem may be with master branch.

I cloned the repo to a new folder and tried CMake on it. But still BUILD_opencv_python is missing. So I don't think that was the issue. And thanks to @berak and @Alexander Mordvintsev for making sure there is no issue in their system. (That means problem is inside my system, not repo).

Then I started to reinstall everything. I changed VS2010 to VS2012.

I installed Python 64-bit, but later I knew there is no official binary of Numpy for 64 bit and I need to compile it from source or pip install. But both require the same exact version of VStudio used for compiling Python, which is VS2008. ( I don't want to download and install it again).

So I reverted to Python 2.7.3-32bit and Numpy-win32-py27-superpack.

Now I tried CMake and everything works fine. I am not sure what solved the problem, whether VS2012 or Python reinstall or something else (because with the same old setup, 2.4 branch worked fine).

If anyone gets any idea what happened here, feel free to share. !!!

edit flag offensive delete link more


There was a problem on master branch when python paths have been erased after consecutive cmake runs. It should be fixed now.

mshabunin gravatar imagemshabunin ( 2015-03-26 10:23:43 -0500 )edit

Question Tools


Asked: 2013-09-01 00:43:36 -0500

Seen: 1,374 times

Last updated: Sep 05 '13