opencv 调用error

python调用动态库error

Linux 下 python3 调用 c++ 编译的动态库时,报 undefined symbol: 

    _ZN2cv6imshowERKNS_6StringERKNS_11_InputArrayE

 

原因:

       opencv cmake编译时未指定正确的python 版本和路径,需要指定python3相关的参数:

cmake

-D CMAKE_BUILD_TYPE=RELEASE

-D CMAKE_INSTALL_PREFIX=/usr/local

-D INSTALL_C_EXAMPLES=ON

-D INSTALL_PYTHON_EXAMPLES=ON

-D BUILD_EXAMPLES=ON

-D WITH_LIBV4L=ON

-D PYTHON3_EXECUTABLE=/root/anaconda3/bin/python

-DPYTHON3_INCLUDE_DIR=root/anaconda3/include/python3.6m

-DPYTHON3_LIBRARY=/root/anaconda3/lib/libpython3.6m.so

-DPYTHON3_NUMPY_INCLUDE_DIRS=/root/anaconda3/lib/python3.6/site-packages/numpy/core/include ..

 

 

你可能感兴趣的:(C/C++,python)