Ask Your Question

Revision history [back]

OpenCV installation error: SyntaxError related to python

Hi, I am trying to install openCV on a remote server, and I keep getting hung up at this error at 98% after running make.

Here is my cmake command

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/home/jbent1/local/opencv-master -DWITH_IPP=OFF -D WITH_LAPACK=OFF -D BUILD_PYTHON_SUPPORT=ON -D PYTHON3_EXECUTABLE=/home/jbent1/local/python/bin/python3 -D PYTHON3_LIBRARIES=/home/jbent1/local/python/lib/libpython3.4m.a -D PYTHONINTERP_FOUND=1 ..

The error message:

    Linking CXX shared library ../../lib/
[ 98%] Built target opencv_videostab
[ 98%] Generating pyopencv_generated_include.h, pyopencv_generated_funcs.h, pyopencv_generated_types.h, pyopencv_generated_type_reg.h, pyopencv_generated_ns_reg.h
Traceback (most recent call last):
  File "/home/jbent1/local/opencv-master/modules/python/python2/..//src2/", line 4, in <module>
    import hdr_parser, sys, re, os
  File "/home/jbent1/local/opencv-master/modules/python/src2/", line 855
    has_mat = len(list(filter(lambda x: x[0] in {"Mat", "vector_Mat"}, args))) > 0
SyntaxError: invalid syntax
make[2]: *** [modules/python2/pyopencv_generated_include.h] Error 1
make[1]: *** [modules/python2/CMakeFiles/opencv_python2.dir/all] Error 2
make: *** [all] Error 2

Any help would be greatly appreciated, as I am totally confused by this. Thanks