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

查看:111
本文介绍了无法在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.

有人可以给我任何建议吗?

Anyone can give me any advice?

推荐答案

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软件包.如果您使用的是LTS版本的ubuntu,这可能很重要.

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天全站免登陆