使用 apt 未找到 Perl 包

使用 apt 未找到 Perl 包

当我尝试升级或安装某些东西时,apt(-get 或 aptitude)会抛出一个错误,说 perl 在尝试配置 libxml-libxml-perl 时找不到 XML/SAX/Debian.pm。以下是完整的错误消息:

configuring libxml-libxml-perl (2.0108+dfsg-1ubuntu0.1) ...
Can't locate XML/SAX/Debian.pm in @INC (you may need to install the XML::SAX::Debian module) (@INC contains: /usr/local/lib/perl5/site_perl/5.20.1/i686-linux-5.20.0-thread-multi-ld /usr/local/lib/perl5/site_perl/5.20.1 /usr/local/lib/perl5/5.20.1/i686-linux-5.20.0-thread-multi-ld /usr/local/lib/perl5/5.20.1 .) at /usr/bin/update-perl-sax-parsers line 19.
BEGIN failed--compilation aborted at /usr/bin/update-perl-sax-parsers line 19.
dpkg: error processing libxml-libxml-perl (--configure) :
 sub-process script post-installation installed returned an error code 2
Errors have been encountered during execution :
 libxml-libxml-perl
E: Sub-process /usr/bin/dpkg returned an error code (1)

我尝试删除(并清除)libxml-libxml-perl,但没有成功。

然后我找到(在 debian 包中)并将 Debian.pm 复制到/usr/local/lib/perl5/site_perl/5.20.1/XML/SAX/

它修复了错误,但出现了另一个错误:

Configuring libxml-libxml-perl (2.0108+dfsg-1ubuntu0.1) ...
update-perl-sax-parsers: Non-vendor version of XML::SAX is installed.
update-perl-sax-parsers: Automatic registration of SAX parsers might not work.
update-perl-sax-parsers: Registering Perl SAX parser XML::LibXML::SAX::Parser with priority 50...
Can't locate XML/LibXML/SAX/Parser.pm in @INC (you may need to install the XML::LibXML::SAX::Parser module) (@INC contains: /usr/local/lib/perl5/site_perl/5.20.1/i686-linux-5.20.0-thread-multi-ld /usr/local/lib/perl5/site_perl/5.20.1 /usr/local/lib/perl5/5.20.1/i686-linux-5.20.0-thread-multi-ld /usr/local/lib/perl5/5.20.1 .) at /usr/local/lib/perl5/site_perl/5.20.1/XML/SAX.pm line 147.
dpkg: error processing package libxml-libxml-perl (--configure) :
 sub-process script post-installation installed returned error code 2
configuring de libgles1-mesa:i386 (10.1.3-0ubuntu0.4) ...
configuring de libshine3:i386 (3.1.0-2) ...
configuring de libva-drm1:i386 (1.4.0~trusty) ...
configuring de libvncclient0:i386 (0.9.9+dfsg-6~ubuntu14.04.1~ppa1) ...
Processing triggers (« triggers ») for libc-bin (2.19-0ubuntu6.6) ...
Errors have been encountered during execution :
 libxml-libxml-perl
E: Sub-process /usr/bin/dpkg returned an error code (1)

我也尝试过dpkg-reconfigure但是:

$ sudo dpkg-reconfigure libxml-libxml-perl
/usr/sbin/dpkg-reconfigure: libxml-libxml-perl is broken or not fully installed

有没有办法来解决这个问题 ?

谢谢您的回答。

PS:错误信息中的某些信息是法语的,我已经翻译了它们,但它们可能与英文错误信息不完全相同。

编辑

sudo dpkg-reconfigure libxml-libxml-perl给我这个:/usr/sbin/dpkg-reconfigure: libxml-libxml-perl is broken or not fully installed

sudo apt-get install --reinstall libxml-libxml-perl得到:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 7 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
E: Internal Error, No file name for libxml-libxml-perl:i386

答案1

我知道这个问题已经有一年了,但我没有看到它被“解决”或有解决方案。此外,这种倒退似乎在系统升级时不断发生,它已经存在了十多年。您可以XML::SAX通过运行来安装(或重新安装)模块

sudo cpanp -i XML::SAX

完成后,你应该能够重新安装perl-xml-libxml而不会出现错误

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

相关内容