报错:libiconv.so.2: cannot open shared object file: No such file or directory

2018年9月17日 | 分类: 【技术】

刚才新开一个VPS,执行 yum 命令时,报错:

There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   libiconv.so.2: cannot open shared object file: No such file or directory

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
2.7.5 (default, Jul 13 2018, 13:06:57)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]

If you cannot solve this problem yourself, please go to
the yum faq at:
  http://yum.baseurl.org/wiki/Faq

方法:给libiconv.so.2做个软件链接
参考:https://blog.csdn.net/jk110333/article/details/7556626

ln -s /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2

遇见这个错误说明没找到libiconv.so.2文件

1. 查看/usr/local/lib下是否有这个库文件,有的话说明已经安装了libiconv,没有说明没有安装
2. 若没有安装就下载个安装包,安装好,再测试。参考:https://amon.org/libiconv
3. 若已经安装:在/etc/ld.so.conf中添加/usr/local/lib,再执行一下ldconfig;或者做一个软连接。测试是否可行。