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

时间:2013-12-19 01:19:36

标签: xml linux r rcurl install.packages

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

我正在尝试为R使用拨浪鼓。我无法安装使用拨浪鼓所需的“XML”。这与一年后right here和另一个操作系统提出的问题几乎相同。以下是我要回复的错误消息:

> 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’

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

4 个答案:

答案 0 :(得分:111)

在Ubuntu上安装curl和xml。运行

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

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

答案 1 :(得分:27)

在CentOS 6+中,您可以使用

进行操作
sudo yum -y install curl
sudo yum -y install libcurl libcurl-devel
sudo yum -y install libxml2 libxml2-devel

答案 2 :(得分:2)

对于不能使用KeyError Traceback (most recent call last) <ipython-input-70-36df2773019b> in <module>() ----> 1 temp2 = df.pivot_table(values='Loan_Status',index=['Credit_History'],aggfunc=lambda x: x.map({'Y':1,'N':0}).mean()) C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\frame.py in pivot_table(self, values, index, columns, aggfunc, fill_value, margins, dropna, margins_name) 5298 aggfunc=aggfunc, fill_value=fill_value, 5299 margins=margins, dropna=dropna, -> 5300 margins_name=margins_name) 5301 5302 def stack(self, level=-1, dropna=True): C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\reshape\pivot.py in pivot_table(data, values, index, columns, aggfunc, fill_value, margins, dropna, margins_name) 57 for i in values: 58 if i not in data: ---> 59 raise KeyError(i) 60 61 to_filter = [] KeyError: 'Loan_Status' yum安装的用户,我分享我的经验:

我通过下载源代码并进行编译来自己安装apt-get。不过,我仍然遇到libcurl-openssl-dev问题。直到查看RCurl源代码并看到引用了Cannot find curl-config环境变量,我才知道该怎么做。我尝试将自己设置为CURL_CONFIG,但似乎可行:

.bashrc

答案 3 :(得分:0)

对于 ubuntu 18.05 有时存储库有问题运行如下

在 sudoedited 行中添加以下存储库

deb http://security.ubuntu.com/ubuntu bionic-security main

sudoedit /etc/apt/sources.list 
sudo apt-get update
sudo apt-get install libcurl4-openssl-dev --fix-broken
sudo apt-get install libcurl4-openssl-dev libxml2-deve