Linux “非零退出状态”R 3.0.1 'XML' 和 'RCurl'

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20671814/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-07 01:40:45  来源:igfitidea点击:

"Non Zero Exit Status" R 3.0.1 'XML' and 'RCurl'

xmllinuxrrcurlinstall.packages

提问by MCP_infiltrator

I am having a bit of trouble installing XML and RCurl on my Ubuntu machine 13.10. I performed all sudo update and upgrades today.

我在我的 Ubuntu 机器 13.10 上安装 XML 和 RCurl 时遇到了一些麻烦。我今天执行了所有 sudo 更新和升级。

I am trying to use rattle for R. I am unable to install 'XML' which is required for the use of rattle. This is pretty much the same question that was asked right herejust a year later and a different OS. Here are the error messages that I am getting back:

我正在尝试为 R 使用拨浪鼓。我无法安装使用拨浪鼓所需的“XML”。这与一年后在这里提出的问题几乎相同,而且是不同的操作系统。以下是我返回的错误消息:

> install.packages("RCurl")
Installing package into ‘/home/steven/R/x86_64-pc-linux-gnu-library/3.0'
(as ‘lib' is unspecified)
trying URL 'http://cran.rstudio.com/src/contrib/RCurl_1.95-4.1.tar.gz'
Content type 'application/x-gzip' length 870915 bytes (850 Kb)
opened URL
==================================================
downloaded 850 Kb

* installing *source* package ‘RCurl' ...
** package ‘RCurl' successfully unpacked and MD5 sums checked
checking for curl-config... no
Cannot find curl-config
ERROR: configuration failed for package ‘RCurl'
* removing ‘/home/steven/R/x86_64-pc-linux-gnu-library/3.0/RCurl'
Warning in install.packages :
  installation of package ‘RCurl' had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpUwBkbS/downloaded_packages'
> install.packages("XML")
Installing package into ‘/home/steven/R/x86_64-pc-linux-gnu-library/3.0'
(as ‘lib' is unspecified)
trying URL 'http://cran.rstudio.com/src/contrib/XML_3.98-1.1.tar.gz'
Content type 'application/x-gzip' length 1582216 bytes (1.5 Mb)
opened URL
==================================================
downloaded 1.5 Mb

* installing *source* package ‘XML' ...
** package ‘XML' successfully unpacked and MD5 sums checked
checking for gcc... gcc
checking for C compiler default output file name... 
rm: cannot remove 'a.out.dSYM': Is a directory
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
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/steven/R/x86_64-pc-linux-gnu-library/3.0/XML'
Warning in install.packages :
  installation of package ‘XML' had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpUwBkbS/downloaded_packages'

Not too sure on how to proceed from here.

不太确定如何从这里开始。

采纳答案by jdharrison

To install curl and xml on Ubuntu. Run

在 Ubuntu 上安装 curl 和 xml。跑

sudo apt-get install libcurl4-openssl-dev libxml2-dev

The error messages on package install in R indicate that the curl and xml libraries are not present or cannot be found.

R 中包安装的错误消息表明 curl 和 xml 库不存在或找不到。

回答by Jijo

In CentOS 6+ you can do it using

在 CentOS 6+ 中,您可以使用

sudo yum -y install curl
sudo yum -y install libcurl libcurl-devel
sudo yum -y install libxml2 libxml2-devel

回答by kjohnsen

For those who can't install using yumor apt-get, I share my experience:

对于那些无法使用yum或安装的人apt-get,我分享我的经验:

I installed libcurl-openssl-devmyself by downloading the source code and compiling. I still ran into the Cannot find curl-configproblem though...I didn't know what to do until looking at RCurl source code and seeing a CURL_CONFIGenvironment variable being referenced. I tried setting this myself in my .bashrcand it seems to have worked:

libcurl-openssl-dev通过下载源代码并编译来安装自己。我仍然遇到了这个Cannot find curl-config问题......直到查看 RCurl 源代码并看到CURL_CONFIG被引用的环境变量之前,我不知道该怎么做。我尝试自己在我的中设置.bashrc它,它似乎奏效了:

export CURL_CONFIG=~/my/libcurl/curl-config

export CURL_CONFIG=~/my/libcurl/curl-config