我正在尝试在使用Ubuntu 14.04的系统上的Python中使用OpenCV。当我尝试导入cv2时,出现以下错误:

 me@Bedrock1:~$ python
 Python 2.7.6 (default, Mar 22 2014, 22:59:56)
 [GCC 4.8.2] on linux2
 Type "help", "copyright", "credits" or "license" for more information.

 >>> import cv2
 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
 ImportError: libavcodec.so.53: cannot open shared object file: No such file or directory

搜索libavcodec.so.53,发现我的系统只有libavcodec.so.54。

互联网搜索显示libavcodec.so.53已从14.04存储库(http://www.ubuntuupdates.org/package/core/trusty/universe/base/libavcodec53)中删除。这可能解释了我无法apt-get安装此库的原因:
 me@Bedrock1:~$ sudo apt-get install libavcodec53 libavcodec-extra-53
 ...
 E: Package 'libavcodec53' has no installation candidate
 E: Package 'libavcodec-extra-53' has no installation candidate

不幸的是,现在我真的被卡住了。

有没有办法让cv2模块使用libavcodec.so.54,或者找到并安装libavcodec.so.53?

注意:我只是按照https://help.ubuntu.com/community/OpenCV上的说明尝试重新安装

但我仍然遇到相同的libavcodec.so.53错误...。

最佳答案

试试这个脚本。 Ubuntu手册页具有此脚本的旧版本。这应该工作。

https://github.com/jayrambhia/Install-OpenCV/blob/master/Ubuntu/2.4/opencv2_4_9.sh

关于python - 适用于OpenCV的Python模块需要Ubuntu 14.04不可用的库,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/25981807/

10-09 05:36