Ubuntu 14.04 配置:错误:“libxml 未找到”

Sky*_*ker 4 xml r xml-libxml ubuntu-14.04

尝试按如下方式安装 XML 包时出现错误configure: error: "libxml not found"。看来 R 正在从 Anaconda 获取 libxml2 安装。我怎样才能解决这个问题?

\n\n
R version 3.4.4 (2018-03-15) -- "Someone to Lean On"\nCopyright (C) 2018 The R Foundation for Statistical Computing\nPlatform: x86_64-pc-linux-gnu (64-bit)\n\n> install.packages("XML")\nInstalling package into \xe2\x80\x98/home/bravegag/R/x86_64-pc-linux-gnu-library/3.4\xe2\x80\x99\n(as \xe2\x80\x98lib\xe2\x80\x99 is unspecified)\ntrying URL \'https://cloud.r-project.org/src/contrib/XML_3.98-1.19.tar.gz\'\nContent type \'application/x-gzip\' length 1600788 bytes (1.5 MB)\n==================================================\ndownloaded 1.5 MB\n\n* installing *source* package \xe2\x80\x98XML\xe2\x80\x99 ...\n** package \xe2\x80\x98XML\xe2\x80\x99 successfully unpacked and MD5 sums checked\nchecking for gcc... gcc\nchecking whether the C compiler works... yes\nchecking for C compiler default output file name... a.out\nchecking for suffix of executables... \nchecking whether we are cross compiling... no\nchecking for suffix of object files... o\nchecking whether we are using the GNU C compiler... yes\nchecking whether gcc accepts -g... yes\nchecking for gcc option to accept ISO C89... none needed\nchecking how to run the C preprocessor... gcc -E\nchecking for sed... /bin/sed\nchecking for pkg-config... /usr/bin/pkg-config\nchecking for xml2-config... /opt/dev/anaconda/2018.12/bin/xml2-config\nUSE_XML2 = yes\nSED_EXTENDED_ARG: -E\nMinor 9, Patch 8 for 2.9.8\nLocated parser file -I/opt/dev/anaconda/2018.12/include/libxml2 -I/opt/dev/anaconda/2018.12/include/parser.h\nChecking for 1.8:  -I/opt/dev/anaconda/2018.12/include/libxml2 -I/opt/dev/anaconda/2018.12/include\nUsing libxml2.*\nchecking for gzopen in -lz... yes\nchecking for xmlParseFile in -lxml2... no\nchecking for xmlParseFile in -lxml... no\nconfigure: error: "libxml not found"\nERROR: configuration failed for package \xe2\x80\x98XML\xe2\x80\x99\n* removing \xe2\x80\x98/home/bravegag/R/x86_64-pc-linux-gnu-library/3.4/XML\xe2\x80\x99\n\nThe downloaded source packages are in\n    \xe2\x80\x98/tmp/RtmpannHh6/downloaded_packages\xe2\x80\x99\nWarning message:\nIn install.packages("XML") :\n  installation of package \xe2\x80\x98XML\xe2\x80\x99 had non-zero exit status\n> \n
Run Code Online (Sandbox Code Playgroud)\n\n

我也明白这个:

\n\n
$ type xml2-config\nxml2-config is /opt/dev/anaconda/2018.12/bin/xml2-config\n
Run Code Online (Sandbox Code Playgroud)\n\n

但在 R 环境中设置配置没有帮助:

\n\n
Sys.setenv(XML_CONFIG="/opt/dev/anaconda/2018.12/bin/xml2-config")\n
Run Code Online (Sandbox Code Playgroud)\n\n

更新我已经在系统中安装了 libxml2 请参阅:

\n\n
bravegag@zeus:~$ sudo apt-get install libxml2\nReading package lists... Done\nBuilding dependency tree       \nReading state information... Done\nlibxml2 is already the newest version.\n0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.\nbravegag@zeus:~$ sudo apt-get install libxml2-dev\nReading package lists... Done\nBuilding dependency tree       \nReading state information... Done\nlibxml2-dev is already the newest version.\n0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.\n
Run Code Online (Sandbox Code Playgroud)\n

std*_*bar 5

确保您的系统已安装libxml-devlibxml2-dev软件包。IE

sudo apt-get install libxml2-dev
Run Code Online (Sandbox Code Playgroud)

我无法确定 14.04 的正确版本(libxml 或 libxml2),但您需要确保已-dev安装该版本。


T. *_*Kau 5

我遇到了同样的错误,但libxml2-dev已经安装了,所以没有帮助。

有什么帮助是通过 conda 安装 libxml 使用

conda install r-xml
Run Code Online (Sandbox Code Playgroud)

我认为通过conda安装R时环境变量有问题。