Raspberry Pi和OpenCV无法安装libhdf5-100

问题描述 投票:-1回答:1

我正在尝试降级并安装OpenCv需要安装的旧版本软件包。

因此,当我尝试安装它时,出现此错误:

pi@raspberrypi:~ $ sudo apt-get install libhdf5-100
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package libhdf5-100 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  libhdf5-103

E: Package 'libhdf5-100' has no installation candidate

我需要在103上安装libhdf5-100才能使opencv正确安装和运行。我正确安装了Opencv,但尝试导入时却收到此错误。

(mypi) pi@raspberrypi:~ $ python
Python 3.5.4 (default, Sep  5 2017, 18:32:10) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pi/mypi/lib/python3.5/site-packages/cv2/__init__.py", line 3, in <module>
    from .cv2 import *
ImportError: libhdf5_serial.so.100: cannot open shared object file: No such file or directory
>>> exit()

如何解决此问题并安装100版本?

linux opencv raspberry-pi3 raspbian
1个回答
-1
投票

确定,我找到了解决方法。因此,您需要Buster升级到OS才能正常工作,然后从这里开始非常简单。

首先,安装所需的所有依赖项。

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install build-essential cmake pkg-config
sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install libxvidcore-dev libx264-dev
sudo apt-get install libfontconfig1-dev libcairo2-dev
sudo apt-get install libgdk-pixbuf2.0-dev libpango1.0-dev
sudo apt-get install libgtk2.0-dev libgtk-3-dev
sudo apt-get install libatlas-base-dev gfortran
sudo apt-get install libhdf5-dev libhdf5-serial-dev libhdf5-103
sudo apt-get install libqtgui4 libqtwebkit4 libqt4-test python3-pyqt5
sudo apt-get install python3-dev

然后您将使用python 3.7创建一个虚拟环境。之后,这是一个简单的pip命令即可使它工作]

pip install opencv-contrib-python==4.1.0.25

我希望这可以帮助陷入困境的人。旧的方法将不再起作用,因此我浪费了美好的一天。

© www.soinside.com 2019 - 2024. All rights reserved.