在为python3.6m编译和安装opencv3.2模块cv2.so之后,导入cv2会导致未定义的符号

时间:2017-03-12 12:56:48

标签: python python-3.x opencv opencv3.0 undefined-symbol

我一直在我的Ubuntu 16.10工作站上为Python 3.6m编译和安装OpenCV 3.2.0。

不幸的是,我收到以下错误:

user@host ~/D/o/cmake> python3 -c "import cv2"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: /usr/local/lib/python3.6/dist-packages/cv2.cpython-36m-x86_64-linux-gnu.so: 
    undefined symbol: _Z13pyopencv_fromIN2cv4MatxIdLi4ELi4EEEEP7_objectRKT_

我一直在配置cmake,如下所示:

cmake \                                                                                   
    -D BUILD_opencv_python3=ON \                                                          
    -D HAVE_opencv_python3=ON \                                                           
    -D PYTHON3LIBS_VERSION_STRING=3.6m \                                                  
    -D PYTHON3_LIBRARIES=/usr/lib/x86_64-linux-gnu/libpython3.6m.so \                     
    -D PYTHON3_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6im.so \                      
    -D PYTHON3_INCLUDE_PATH=/usr/include/python3.6m \                                     
    -D PYTHON3_INCLUDE_DIR=/usr/include/python3.6m \                                      
    -D CMAKE_BUILD_TYPE=RELEASE \                                                         
    -D CMAKE_INSTALL_PREFIX=/usr/local \                                                  
    -D BUILD_NEW_PYTHON_SUPPORT=ON \                                                      
    -D INSTALL_C_EXAMPLES=ON \                                                            
    -D INSTALL_PYTHON_EXAMPLES=ON \                                                       
    -D BUILD_EXAMPLES=ON \                                                                
    -DENABLE_PRECOMPILED_HEADERS=OFF \                                                    
    -D OPENCV_EXTRA_MODULES_PATH=/home/user/Downloads/opencv_contrib/modules ..      

有什么可能导致未定义符号的想法? 这可能与ldconfig相关吗?

0 个答案:

没有答案