OpenCV installation in virtualenv: error “Could NOT find PythonLibs”

asked 2014-10-29 14:01:54 -0600

sagnik gravatar image

I am trying to install the latest version of OpenCV on RHEL6. I have python 2.7.8 in a virtualenv (following this SO question ). My settings are like this:

  python_home=/home/abc/localpython/
  virtualenv_dir=/home/abc/virtualenv/opencvpython

I have a file libpython2.7.a at /home/abc/localpython/lib . Following this SO question, I set up the environment variables like this before running cmake:

PYTHON_EXECUTABLE=/home/abc/virtualenvs/opencvpython/bin/python2.7
PYTHON_INCLUDE=/home/abc/virtualenvs/opencvpython/include
PYTHON_LIBRARY=/home/abc/localpython/lib/libpython2.7.a
PYTHON_PACKAGES_PATH=/home/abc/virtualenvs/opencvpython/lib/python2.7/site-packages/
PYTHON_NUMPY_INCLUDE_DIR=/home/abc/virtualenvs/opencvpython/lib/python2.7/site-packages/numpy/core/include

But I get the following error:

Found PythonInterp: /home/abc/virtualenvs/opencvpython/bin/python2.7 (found suitable version "2.7.8", minimum required is "2.7") 
-- Could NOT find PythonLibs: Found unsuitable version "2.7", but required is exact version "2.7.8" (found /home/abc/localpython/lib/libpython2.7.a)
-- Could NOT find PythonInterp: Found unsuitable version "2.7.8", but required is at least "3.4" (found /home/abc/virtualenvs/opencvpython/bin/python)
-- Could NOT find PythonInterp: Found unsuitable version "2.7.8", but required is at least "3.2" (found /home/abc/virtualenvs/opencvpython/bin/python)

I think the last two lines are because cmake is trying to compile python 3 modules of opencv, which I don't require. The most important line is:

Could NOT find PythonLibs: Found unsuitable version "2.7", but required is exact version "2.7.8" (found /home/abc/localpython/lib/libpython2.7.a).

Why is cmake saying the pythonlibs has a version of 2.7 when the python version is 2.7.8? Or am I doing something wrong?

edit retag flag offensive close merge delete