问题描述
我使用pip在Anaconda虚拟环境上通过以下命令安装opencv3.
I used pip to install opencv3 with the following command on an Anaconda virtual environment.
install opencv-python
我成功安装了它,因为我可以在pip列表中看到该软件包.
I successfully installed it because I can see the package in pip list.
(olfatf)rover@rover_pi:/usr/lib/arm-linux-gnueabihf $ pip list | grep opencv
opencv-python 3.4.0.14
但是,当我导入cv2时,出现以下错误:
However, when I do import cv2, I get the following error:
(olfatf)rover@rover_pi:/usr/lib/arm-linux-gnueabihf $ python
Python 3.4.3 |Continuum Analytics, Inc.| (default, Aug 21 2015, 00:53:08)
[GCC 4.6.3] 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/.conda/envs/olfatf/lib/python3.4/site-packages/cv2/__init__.py", line 3, in <module>
from .cv2 import *
ImportError: libavformat.so.56: cannot open shared object file: No such file or directory
我检查了/usr/lib/arm-linux-gnueabihf
目录,发现:
(olfatf)rover@rover_pi:/usr/lib/arm-linux-gnueabihf $ ls | grep libavformat
libavformat.a
libavformat.so
libavformat.so.57
libavformat.so.57.56.101
我在那里可以看到,我有版本57,但缺少版本56.我在网上进行了研究,有人建议我应该安装libavformat-dev
I you can see there, I have the version 57 but the version 56 is missing.I did research online and people suggested that I should install libavformat-dev
(olfatf)rover@rover_pi:/usr/lib/arm-linux-gnueabihf $ sudo apt-get install libavformat-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libavformat-dev is already the newest version (7:3.2.10-1~deb9u1+rpt1).
但是它表示该软件包已经存在.我也尝试安装ffmpeg.
But it says that the package already exists. I also tried installing ffmpeg.
(olfatf)rover@rover_pi:/usr/lib/arm-linux-gnueabihf $ sudo apt-get install ffmpeg
Reading package lists... Done
Building dependency tree
Reading state information... Done
ffmpeg is already the newest version (7:3.2.10-1~deb9u1+rpt1).
但是它说包已经存在.
如何获取56版本?我使用Raspberry Pi Strech
How to get the 56 version?I use Raspberry Pi Strech
推荐答案
经过20个小时的研究,我通过从源代码进行编译解决了该问题.我使用了教程在Anaconda Environmnent上安装opencv
After 20 hours of research, I solved the problem by compiling from source. I used this tutorial to install opencv on Anaconda Environmnent
这篇关于如何与libavformat.so.57一起安装libavformat.so.56?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!