无法在 Ubuntu 11.04 中安装 R 包 [英] Unable to install R package in Ubuntu 11.04

查看:33
本文介绍了无法在 Ubuntu 11.04 中安装 R 包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Linux 和 R 的新手.

I'm new to Linux and R.

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

I installed R 2.12 in Ubuntu 11.04. Today I tried to install a new package, so I ran the following command:

install.packages('XML')

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

But the installation failed and gave the following information:

* 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')

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

But it gives the same error information.

谁能给我一些建议?

推荐答案

install.packages 方法

你需要安装ubuntu包libxml2-dev 所以在shell提示符下输入:

You need to install the ubuntu package libxml2-dev So in a shell prompt type:

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

为此您需要特殊的 sudo 权限.

You will need special sudo powers for this.

Ubuntu 打包方法

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

As Richie and Dirk mentioned, you can also use:

sudo apt-get install r-cran-xml

如果你走这条路,我建议你查看 R ubuntu源 页面,这将确保您拥有当前版本的 R 和相关的 R 包.如果您使用的是 ubuntu 的 LTS 版本,这可能很重要.

If you go down this path, I would recommend that you check out the R ubuntu sources page which will ensure you have a current version of R and the associated R packages. This could be important if you are using the LTS version of ubuntu.

这篇关于无法在 Ubuntu 11.04 中安装 R 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆