无法在R 3.1.2中安装devtools

xia*_*o87 11 r devtools

我试图在Rstudio中安装devtools包install.packages("devtools")但失败了.错误消息是:

* 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’
Run Code Online (Sandbox Code Playgroud)

看起来很难找到libxml-2.0.有谁知道这个很容易解决?我正在使用R版本3.1.2.

xia*_*o87 12

最终我通过以下方式修复了问题:

sudo apt-get install libxml2-dev
Run Code Online (Sandbox Code Playgroud)

然后出现了另一个问题:

Error : object ‘curl_fetch_memory’ is not exported by 'namespace:curl'
Run Code Online (Sandbox Code Playgroud)

这可以通过安装curl包来解决:

install.packages("curl")
Run Code Online (Sandbox Code Playgroud)

  • 要安装`curl`,我需要运行`sudo apt-get install libcurl4-openssl-dev`; 在Linux Mint 17上运行`R version 3.2.1 RC(2015-06-10 r68509)`(基于Ubuntu Trusty构建) (8认同)