如何在Ubuntu Linux上安装XML :: LibXML
时间:2020-01-09 10:45:14 来源:igfitidea点击:
在Ubuntu运行Perl报错:
Can't locate XML/LibXML.pm in @INC (you may need to install the XML::LibXML module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /usr/local/share/perl/5.22.1 /usr/lib/x86_64-linux-gnu/perl5/5.22 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 /usr/share/perl/5.22 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base .) at ./run_test.pl line 15. BEGIN failedcompilation aborted at ./run_test.pl line 15.
尝试使用以下命令安装LibXML Perl模块:
sudo cpan install XML::LibXML
但是这个命令又遇到了麻烦。完整的输出是这样的:
Loading internal null logger. Install Log::Log4perl for logging messages Reading ‘/home/abhi/.cpan/Metadata' Database was generated on Thu, 23 Mar 2017 09:41:02 GMT Running install for module ‘XML::LibXML' Checksum for /home/abhi/.cpan/sources/authors/id/S/SH/SHLOMIF/XML-LibXML-2.0129.tar.gz ok ‘YAML' not installed, will not store persistent state Configuring S/SH/SHLOMIF/XML-LibXML-2.0129.tar.gz with Makefile.PL enable native perl UTF8 running xml2-config…didn't manage to get libxml2 config, guessing options: LIBS='-L/usr/local/lib -L/usr/lib -lxml2 -lm' INC='-I/usr/local/include -I/usr/include' If this is wrong, Re-run as: $ /usr/bin/perl Makefile.PL LIBS='-L/path/to/lib' INC='-I/path/to/include' Checking for ability to link against xml2…no Checking for ability to link against libxml2…libxml2, zlib, and/or the Math library (-lm) have not been found. Try setting LIBS and INC values on the command line Or get libxml2 from http://xmlsoft.org/ If you install via RPMs, make sure you also install the -devel RPMs, as this is where the headers (.h files) are. Also, you may try to run perl Makefile.PL with the DEBUG=1 parameter to see the exact reason why the detection of libxml2 installation failed or why Makefile.PL was not able to compile a test program. No ‘Makefile' created SHLOMIF/XML-LibXML-2.0129.tar.gz /usr/bin/perl Makefile.PL INSTALLDIRS=site — NOT OK
如何在Ubuntu或者任何其他基于Ubuntu的Linux发行版上安装LibXML模块。
如何在Ubuntu Linux上安装LibXML Perl模块
上面显示的错误输出中突出显示了LibXML安装失败的原因:
Checking for ability to link against libxml2…libxml2, zlib, and/or the Math library (-lm) have not been found.
显然,系统缺少libxml2和zlib库。要解决此问题,我们所需要做的就是使用以下命令安装所需的库:
sudo apt-get install zlib1g-dev libxml2-dev
一旦安装了库,就以常规方式继续安装LibXML Perl模块:
sudo cpan install XML::LibXML