73

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

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

> 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

4 回答 4

127

在 Ubuntu 上安装 curl 和 xml。跑

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

R 中 package install 的错误消息表明 curl 和 xml 库不存在或找不到。

于 2013-12-20T02:55:27.733 回答
28

在 CentOS 6+ 中,您可以使用

sudo yum -y install curl
sudo yum -y install libcurl libcurl-devel
sudo yum -y install libxml2 libxml2-devel
于 2014-01-23T09:43:52.103 回答
2

对于那些无法使用yumor安装的人apt-get,我分享一下我的经验:

libcurl-openssl-dev我通过下载源代码和编译安装自己。我仍然遇到了这个Cannot find curl-config问题......直到查看 RCurl 源代码并看到一个CURL_CONFIG环境变量被引用,我才知道该怎么做。我尝试自己设置.bashrc它,它似乎有效:

export CURL_CONFIG=~/my/libcurl/curl-config

于 2018-07-03T23:32:01.980 回答
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-dev

修复包名

于 2020-12-19T05:27:00.057 回答