gpt4 book ai didi

xml - 无法在 Ubuntu 11.04 中安装 R 包

转载 作者:太空宇宙 更新时间:2023-11-04 03:54:19 33 4
gpt4 key购买 nike

我是 Linux 和 R 新手。

我在 Ubuntu 11.04 中安装了 R 2.12。今天我尝试安装一个新包,所以我运行了以下命令:

install.packages('XML')

但是安装失败并给出以下信息:

* installing *source* package ‘XML’ ...
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
No ability to remove finalizers on externalptr objects in this verison of R
checking for sed... /bin/sed
checking for pkg-config... /usr/bin/pkg-config
checking for xml2-config... no
Cannot find xml2-config
ERROR: configuration failed for package ‘XML’
* removing ‘/home/spirit/R/i686-pc-linux-gnu-library/2.12/XML’

The downloaded packages are in
‘/tmp/RtmpoZYxnv/downloaded_packages’
Warning message:
In install.packages("XML") :
installation of package 'XML' had non-zero exit status

我也尝试过:

sudo install.packages('XML')

但它给出了相同的错误信息。

谁能给我一些建议吗?

最佳答案

install.packages方法

您需要安装 ubuntu 软件包 libxml2-dev 因此,在 shell 提示符中输入:

sudo apt-get update
sudo apt-get install libxml2-dev

为此,您需要特殊的 sudo 权限。

Ubuntu打包方法

正如 Richie 和 Dirk 提到的,您还可以使用:

sudo apt-get install r-cran-xml

如果您沿着这条路走下去,我建议您查看 R ubuntu sources页面,这将确保您拥有最新版本的 R 和关联的 R 包。如果您使用的是 ubuntu 的 LTS 版本,这一点可能很重要。

关于xml - 无法在 Ubuntu 11.04 中安装 R 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25270219/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com