从 12.04 升级到 14.04 后 libxml2 出现问题的原因

从 12.04 升级到 14.04 后 libxml2 出现问题的原因

从 12.04 64bit LTS 升级到 ubuntu 14.04 64bit LTS 后,libxml2 出现问题。

无法运行软件中心、Empathy 等

# software-center
 Traceback (most recent call last):
  File "/usr/bin/software-center", line 128, in <module>
   from softwarecenter.ui.gtk3.app import SoftwareCenterAppGtk3
  File "/usr/share/software-center/softwarecenter/ui/gtk3/app.py", line 106, in <module>
   from softwarecenter.ui.gtk3.panes.installedpane import InstalledPane
  File "/usr/share/software-center/softwarecenter/ui/gtk3/panes/installedpane.py", line 34, in <module>
   from softwarecenter.db.categories import (CategoriesParser,
  File "/usr/share/software-center/softwarecenter/db/categories.py", line 30, in <module>
   import lxml.etree as ET
ImportError: /usr/local/lib/libxml2.so.2: version `LIBXML2_2.9.0' not found (required by /usr/lib/python2.7/dist-packages/lxml/etree.so)

或者

# empathy
empathy: /usr/local/lib/libxml2.so.2: version `LIBXML2_2.9.0' not found (required by /usr/lib/x86_64-linux-gnu/libxslt.so.1)

做过

# locate libxml2.so
/opt/openoffice4/program/libxml2.so.2
/usr/lib/i386-linux-gnu/libxml2.so.2
/usr/lib/i386-linux-gnu/libxml2.so.2.9.1
/usr/lib/vmware-installer/2.1.0/lib/lib/libxml2.so.2
/usr/lib/vmware-installer/2.1.0/lib/lib/libxml2.so.2/libxml2.so.2
/usr/lib/vmware-vmrc/5.1/lib/libxml2.so.2
/usr/lib/vmware-vmrc/5.1/lib/libxml2.so.2/libxml2.so.2
/usr/lib/x86_64-linux-gnu/libxml2.so
/usr/lib/x86_64-linux-gnu/libxml2.so.2
/usr/lib/x86_64-linux-gnu/libxml2.so.2.9.1
/usr/local/lib/libxml2.so
/usr/local/lib/libxml2.so.2
/usr/local/lib/libxml2.so.2.8.0

或者

# sudo dpkg --list | grep libxml2
ii  libxml-libxml-perl       2.0108+dfsg-1                                       
ii  libxml2:amd64            2.9.1+dfsg1-3ubuntu4.3                              
ii  libxml2:i386             2.9.1+dfsg1-3ubuntu4.3
ii  libxml2-dev:amd64        2.9.1+dfsg1-3ubuntu4.3
ii  python-libxml2           2.9.1+dfsg1-3ubuntu4.3        
ii  python-lxml              3.3.3-1ubuntu0.1                                    
ii  python3-lxml             3.3.3-1ubuntu0.1

或者

sudo apt-get install --reinstall libxml-libxml-perl

Warning: program compiled against libxml 209 using older 208
Warning: XML::LibXML compiled against libxml2 20901, but runtime libxml2 is older 20800
update-perl-sax-parsers: Registering Perl SAX parser XML::LibXML::SAX with priority 50...
Warning: program compiled against libxml 209 using older 208
Warning: XML::LibXML compiled against libxml2 20901, but runtime libxml2 is older 20800
update-perl-sax-parsers: Updating overall Perl SAX parser modules info file...
Replacing config file /etc/perl/XML/SAX/ParserDetails.ini with new version

答案1

我在将 debian squeeze 升级到 jessie 之后,又升级到不稳定版本,也遇到了同样的问题。问题是,你的系统中有一个旧版本的 libxml2 库当地的文件夹/usr/local/lib

您很可能已经在包管理器中安装了正确的版本/usr/lib/x86_64-linux-gnu/,但是本地文件夹中的库具有更高的优先级,因此最终会加载它。

如果我的所有假设都是正确的,那么您应该能够通过以 root 身份运行以下命令来解决问题:

# mv /usr/local/lib/libxml2* /

然后尝试运行 empathy 或其他遇到问题的应用程序。如果一切正常,您可以通过运行以下命令删除未使用的旧库:

# rm -f /libxml2*

相关内容