opencv3.4.2安装完成后import cv2出现的问题及解决办法

问题:

>>> import cv2
Traceback (most recent call last):
  File "", line 1, in
  File "/usr/local/lib/python2.7/site-packages/cv2/__init__.py", line 89, in
    bootstrap()
  File "/usr/local/lib/python2.7/site-packages/cv2/__init__.py", line 79, in bootstrap
    import cv2
ImportError: libopencv_ml.so.4.1: cannot open shared object file: No such file or directory

 

解决办法:

find / -name "libopencv_ml.so.4.1"

提示路径

/usr/local/lib64/share/lib/libopencv_ml.so.4.1

export LD_LIBRARY_PATH=/usr/local/lib64/share/lib/:$LD_LIBRARY_PATH

永久解决办法,加入环境变量bashrc

你可能感兴趣的:(opencv)