简体   繁体   中英

opencv import error (libopencv_dnn.so.3.4 undefined symbol)

System information:

Ubuntu 16.04, Anaconda 1.6.9, Python 3.6.4, libopencv 3.4.1, opencv 3.4.1, py-opencv 3.4.1.

Problem definition: I just upgraded my opencv to 3.4 through anaconda and found could not import.

The import error is:

ImportError: anaconda3/lib/python3.6/site-packages/../../libopencv_dnn.so.3.4: undefined symbol: _ZNK6google8protobuf7Message25InitializationErrorStringB5cxx11Ev

以下解决方案对我有用,尽管不确定原因和方式。

  1. conda install -c defaults libprotobuf protobuf
  2. conda install -c menpo opencv3

Have you tried this answer from GitHub :

  1. Configure /usr/local/cuda/include/host_config.h as suggested. ( remove the gcc 5 error from the CUDA header host_config.h )
  2. sudo apt-get autoremove libprotobuf-dev protobuf-compiler
  3. then compile the protobuf-2.5.0 from src and install Please config the gcc when you compile protobuf ./configure --prefix=/usr/local/ CC=/usr/bin/gcc

Also (GitHub user groakat mentions):

for me this problem was caused because I had protobuf installed in anaconda. If you have protobuf installed in your anaconda environment, you have to remove all files by hand, as conda uninstall protobuf does not remove all the library files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM