[英]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.