Raspberry Pi 并且 OpenCV 无法安装 libhdf5-100
Raspberry Pi and OpenCV can't install libhdf5-100
我正在尝试降级并安装 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
我需要 libhdf5-100 而不是 103,以便 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 版本?
好的,我找到了解决方法。所以你需要 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
我希望这能帮助遇到困难的人。老方法不行了,浪费了一天的时间。
我正在尝试降级并安装 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
我需要 libhdf5-100 而不是 103,以便 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 版本?
好的,我找到了解决方法。所以你需要 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
我希望这能帮助遇到困难的人。老方法不行了,浪费了一天的时间。