简体   繁体   English

安装opencv3.3后,导入cv2会显示“ libopencv_imgcodecs.so.3.1:无法打开共享对象文件”

[英]After installing opencv3.3,import cv2 gives “libopencv_imgcodecs.so.3.1: cannot open shared object file”

I have cleaned opencv 3.1 from ubuntu 16.04 我已经从Ubuntu 16.04清理了opencv 3.1

run "sudo cat install_manifest.txt | xargs echo sudo rm | sh" 
and rm cv2.so from /usr/lib/python2.7/dist-packages/cv2.so,

upgrade to 3.3 manually(cmake/make/make install) then 手动升级到3.3(cmake / make / make install)然后

sudo ldconfig
run:ldd /usr/lib/python2.7/dist-packages/cv2.so

got 得到

linux-vdso.so.1 =>  (0x00007ffc85de1000)
    libopencv_hdf.so.3.3 => /usr/lib/x86_64-linux-gnu/libopencv_hdf.so.3.3 (0x00007f605d4bd000)
    libopencv_reg.so.3.3 => /usr/lib/x86_64-linux-gnu/libopencv_reg.so.3.3 (0x00007f605cf8a000)

but under ipython 但是在ipython下

  import cv2

gives me: 给我:

ImportError: libopencv_imgcodecs.so.3.1: cannot open shared object file: No such file or directory

Obviously,it is trying to use previous version,and it seems something has been cached,am I right?How to solve this problem? 显然,它正在尝试使用以前的版本,似乎已缓存了一些内容,对吗?如何解决此问题?

I got exactly the same issue.Corrected now. 我遇到了完全相同的问题。现在已更正。 You can check the module path in python : 您可以在python中检查模块路径:

import sys
print(sys.path)

This will show you were python is trying to catch the cv2.so when doing import cv2. 这将显示您在执行导入cv2时python试图捕获cv2.so。 Then check in all the folders mentioned in the print result if an old cv2.so or a symlink is not remaining, so taking place of the new one you try to use. 然后,如果没有保留旧的cv2.so或符号链接,请检入打印结果中提到的所有文件夹,以代替尝试使用的新文件夹。

It could be simply in the '.' 可能只是在“。”中。 current folder as '.' 当前文件夹为“。” is part of the syspath. 是syspath的一部分。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Sagemaker Studio jupyter 笔记本中导入 cv2 抛出 ImportError: libGL.so.1: cannot open shared object file: No such file or directory - import cv2 in Sagemaker Studio jupyter notebook throws ImportError: libGL.so.1: cannot open shared object file: No such file or directory 导入 cv2 时出错:“libSM.so.6:无法打开共享对象文件:没有这样的文件或目录” - Error importing cv2: 'libSM.so.6: cannot open shared object file: No such file or directory' ImportError: libgthread-2.0.so.0: cannot open shared object file: No such file or directory when importing cv2 using Docker container - ImportError: libgthread-2.0.so.0: cannot open shared object file: No such file or directory when importing cv2 using Docker container python3:无法导入cv2:安装opencv_contrib模块后DLL加载失败 - python3 : Cannot Import cv2 : DLL load failed after installing opencv_contrib modules AWS Lambda Opencv(“无法导入模块‘lambda_function’:libgthread-2.0.so.0:无法打开共享对象文件:没有这样的文件或目录”) - AWS Lambda Opencv ("Unable to import module 'lambda_function': libgthread-2.0.so.0: cannot open shared object file: No such file or directory") Python OpenCV转储cv2对象到文件? - Python OpenCV dump a cv2 object to file? 导入cv2失败-为Windows安装适用于Python 2.7的OpenCV - import cv2 failed - installing OpenCV for Python 2.7 for Windows 无法识别OpenCV导入cv2 - OpenCV import cv2 not recognised 成功安装opencv3.4.0后出现“no module named cv2” - “no module named cv2” after installing opencv3.4.0 successfully cv2 安装成功后无法导入 - cv2 won't import after successfully installing it
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM