安装opencv时报错 ImportError: libXrender.so.1: cannot open shared object file: No such file or directory
解决办法:
方法一:
执行
apt-get install libxrender1
以安装libxrender1
但显示需要python2.7,我用的3.5,因此未能安装成功.
出错代码:
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
python-minimal : Depends: python2.7-minimal (>= 2.7.12-1~) but it is not going to be installed
Recommends: python but it is not going to be installed
python2.7 : Depends: python2.7-minimal (= 2.7.12-1ubuntu0~16.04.3) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
因此使用方法二:
下载deb软件包,再使用dpkg命令手动安装
具体步骤:
1.在https://pkgs.org/上搜索对应版本deb安装包,比如我的Linux Ubentu 64位安装libxrender1_0.9.9-0ubuntu1_amd64.deb下载地址
(可以在Linux系统中用wget命令直接下载)
2.进入Liunx终端,找到deb目录下,执行
dpkg -i libxrender1_0.9.9-0ubuntu1_amd64.deb
安装好后再进入python,import cv2不再报错