简体   繁体   English

无法在R 3.1.2中安装devtools

[英]Failed to install devtools in R 3.1.2

I was trying to install the devtools package in Rstudio by install.packages("devtools") but failed. 我试图通过install.packages("devtools")在Rstudio中安装devtools包,但失败了。 The error messages are: 错误消息是:

* installing *source* package ‘xml2’ ...
** package ‘xml2’ successfully unpacked and MD5 sums checked
Package libxml-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libxml-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libxml-2.0' found
Package libxml-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libxml-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libxml-2.0' found
Could not find libxml2. Please install libxml2-devel (rpm) or libxml2-dev (deb).
ERROR: configuration failed for package ‘xml2’
* removing ‘/home/xwang/R/x86_64-pc-linux-gnu-library/3.1/xml2’
Warning in install.packages :
  installation of package ‘xml2’ had non-zero exit status
ERROR: dependency ‘xml2’ is not available for package ‘rversions’
* removing ‘/home/xwang/R/x86_64-pc-linux-gnu-library/3.1/rversions’
Warning in install.packages :
  installation of package ‘rversions’ had non-zero exit status
ERROR: dependency ‘rversions’ is not available for package ‘devtools’
* removing ‘/home/xwang/R/x86_64-pc-linux-gnu-library/3.1/devtools’
Warning in install.packages :
  installation of package ‘devtools’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpYccDpT/downloaded_packages’

Looks like it has trouble finding libxml-2.0 . 看起来很难找到libxml-2.0 Does anyone know an easy fix to this? 有谁知道这个很容易解决? I'm using R version 3.1.2. 我正在使用R版本3.1.2。

Eventually I fixed the problem by: 最终我通过以下方式修复了问题:

sudo apt-get install libxml2-dev

Then another problems popped up: 然后出现了另一个问题:

Error : object ‘curl_fetch_memory’ is not exported by 'namespace:curl'

which can be solved by installing the curl package: 这可以通过安装curl包来解决:

install.packages("curl")

您只需要更新到最新版本的R(R版本3.2.1)

It require some developer libraries (sources): curl developer , xml2 developer as dependecy. 它需要一些开发人员库(源代码): curl developerxml2 developer作为依赖。 so install it with the package repository (yum, dnf, apt-get) and retry to install the devtools package in R. 所以用包存储库(yum,dnf,apt-get)安装它,然后重试在R中安装devtools包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM