ImportError: libhdf5_serial.so.100: cannot open shared object file: No such file or directory

记录贴

环境:RK3288 Ubuntu Python3.5

1.使用命令安装opencv-contrib-python:

 

pip3 install opencv-contrib-python==3.3.0.9 -i https://www.piwheels.org/simple

2.测试是否安装成功

python3
import cv2

3.报错:

Traceback (most recent call last):
  File "", line 1, in 
  File "/home/newland/.local/lib/python3.5/site-packages/cv2/__init__.py", line 9, in 
    from .cv2 import *
ImportError: libhdf5_serial.so.100: cannot open shared object file: No such file or directory

4.根据博客https://blog.csdn.net/qq_38269799/article/details/83384291提供方案安装如下依赖:

sudo apt-get update #安装依赖库
sudo apt-get install libhdf5-dev
sudo apt-get install libatlas-base-dev
sudo apt-get install libjasper-dev
sudo apt-get install libqt4-test
sudo apt-get install libqtgui4
sudo apt-get update

5.依然出现 3 中的错误信息:

6.查找 libhdf5_serial.so

sudo find / -name "libhdf5_serial.so*" -print

7.查找结果如下,发现存在libhdf5_serial.so.xxx ,但libhdf5_serial.so.100 不存在

find: '/run/user/1000/gvfs': Permission denied
/usr/lib/arm-linux-gnueabihf/libhdf5_serial.so.10
/usr/lib/arm-linux-gnueabihf/libhdf5_serial.so.10.1.0
/usr/lib/arm-linux-gnueabihf/libhdf5_serial.so

8.尝试将 libhdf5_serial.so.10 复制并重命名为 libhdf5_serial.so.100 (复制并重名到当前目录下)

sudo cp /usr/lib/arm-linux-gnueabihf/libhdf5_serial.so.10 /usr/lib/arm-linux-gnueabihf/libhdf5_serial.so.100

9.再次测试是否可用

python3
import cv2

10. 旧的报错消失,但又出现新的报错

ImportError: libjpeg.so.62: cannot open shared object file: No such file or directory

11.不要慌,安装libjpeg62即可

sudo apt-get install libjpeg62

12.再次测试是否可用,测试通过

Python 3.5.2 (default, Apr 16 2020, 17:47:17) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> 

13.到此问题解决

你可能感兴趣的:(python,python,linux,opencv)