【问题标题】:Failed to install devtools in R 3.1.2无法在 R 3.1.2 中安装 devtools
【发布时间】:2015-08-30 12:14:47
【问题描述】:

我试图通过install.packages("devtools") 在 Rstudio 中安装 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’

看起来很难找到libxml-2.0。有谁知道一个简单的解决方法?我使用的是 R 版本 3.1.2。

【问题讨论】:

标签: r devtools


【解决方案1】:

最终我通过以下方式解决了问题:

sudo apt-get install libxml2-dev

然后又出现了一个问题:

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

可以通过安装curl包解决:

install.packages("curl")

【讨论】:

  • 要安装curl,我需要运行sudo apt-get install libcurl4-openssl-dev;在 Linux Mint 17 上运行 R version 3.2.1 RC (2015-06-10 r68509)(基于 Ubuntu Trusty)
  • R 3.2.3,Linux Mint 18.1,我还需要sudo apt-get install libcurl4-openssl-dev
【解决方案2】:

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

【讨论】:

    【解决方案3】:

    它需要一些开发人员库(来源):curl developer、xml2 developer 作为依赖项。 所以用包存储库(yum、dnf、apt-get)安装它,然后重试在 R 中安装 devtools 包。

    【讨论】:

      猜你喜欢
      • 2015-03-10
      • 2015-02-20
      • 2015-09-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-04
      • 2013-12-12
      • 2020-01-08
      相关资源
      最近更新 更多