我试图通过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。
答案 0 :(得分:12)
最终我通过以下方式解决了问题:
sudo apt-get install libxml2-dev
然后又出现了另一个问题:
Error : object ‘curl_fetch_memory’ is not exported by 'namespace:curl'
可以通过安装curl包来解决:
install.packages("curl")
答案 1 :(得分:1)
您只需要更新到最新版本的R(R版本3.2.1)
答案 2 :(得分:0)
它需要一些开发人员库(来源):curl developer
,xml2 developer
作为依赖。
所以用软件包存储库(yum,dnf,apt-get)安装它,然后重试在R中安装devtools软件包。