R / RStudio – 由于未findlibcurl而导致configuration失败

我想从一个使用fromJSON的远程服务器拉一些json数据:

 > server <- 'http://111.111.000.00:3000' > streams <- fromJSON(paste(server, '/output/streams', sep=""), flatten=TRUE) 

结果:

 Error: Required package curl not found. Please run: install.packages('curl') 

所以我试图安装它:

 > install.packages("curl") Installing package into '/home/lauxxx/R/x86_64-pc-linux-gnu-library/3.3' (as 'lib' is unspecified) trying URL 'https://cran.rstudio.com/src/contrib/curl_2.3.tar.gz' Content type 'application/x-gzip' length 400460 bytes (391 KB) ================================================== downloaded 391 KB * installing *source* package 'curl' ... ** package 'curl' successfully unpacked and MD5 sums checked Using PKG_CFLAGS= Using PKG_LIBS=-lcurl ------------------------- ANTICONF ERROR --------------------------- Configuration failed because libcurl was not found. Try installing: * deb: libcurl4-openssl-dev (Debian, Ubuntu, etc) * rpm: libcurl-devel (Fedora, CentOS, RHEL) * csw: libcurl_dev (Solaris) If libcurl is already installed, check that 'pkg-config' is in your PATH and PKG_CONFIG_PATH contains a libcurl.pc file. If pkg-config is unavailable you can set INCLUDE_DIR and LIB_DIR manually via: R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...' -------------------------------------------------------------------- ERROR: configuration failed for package 'curl' * removing '/home/lauxxx/R/x86_64-pc-linux-gnu-library/3.3/curl' Warning in install.packages : installation of package 'curl' had non-zero exit status The downloaded source packages are in '/tmp/RtmpdoavNf/downloaded_packages' 

然后我试图安装libcurl4-openssl-dev

 > install.packages("libcurl4-openssl-dev") Installing package into '/home/lau/R/x86_64-pc-linux-gnu-library/3.3' (as 'lib' is unspecified) Warning in install.packages : package 'libcurl4-openssl-dev' is not available (for R version 3.3.1) 

为什么? 出了什么问题? 我该如何解决?

当我在Xubuntu 16.04上时是可以的。 但是现在我在Kubuntu 16.10上。

有任何想法吗?

libcurl4-openssl-dev不是一个R包,而是一个linux库。 在控制台中输入sudo apt-get install libcurl4-openssl-dev 。 当然你需要sudo权力。

Linux版本是:CentOS Linux版本7.3.1611(核心)

在我的情况下,我试图安装R包:devtools

------------------------- ANTICONF ERROR --------------------------- Configuration failed because libcurl was not found. Try installing: * deb: libcurl4-openssl-dev (Debian, Ubuntu, etc) * rpm: libcurl-devel (Fedora, CentOS, RHEL) * csw: libcurl_dev (Solaris) If libcurl is already installed, check that 'pkg-config' is in your PATH and PKG_CONFIG_PATH contains a libcurl.pc file. If pkg-config is unavailable you can set INCLUDE_DIR and LIB_DIR manually via: R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...' ------------------------- ANTICONF ERROR --------------------------- Configuration failed because libcurl was not found. Try installing: * deb: libcurl4-openssl-dev (Debian, Ubuntu, etc) * rpm: libcurl-devel (Fedora, CentOS, RHEL) * csw: libcurl_dev (Solaris) If libcurl is already installed, check that 'pkg-config' is in your PATH and PKG_CONFIG_PATH contains a libcurl.pc file. If pkg-config is unavailable you can set INCLUDE_DIR and LIB_DIR manually via: R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'我检查了$ PATH,'pkg-config'在PATH 。 但PKG_CONFIG_PATH(/ usr / local / lib / pkgconfig /)中没有libcurl.pc文件。

这是我如何解决这个问题。 su wget https://github.com/curl/curl/releases/download/curl-7_55_0/curl-7.55.0.tar.gz ./configure make make install

在此之后,我看到了PKG_CONFIG_PATH(/ usr / local / lib / pkgconfig /)中的libcurl.pc文件。

希望这可以帮助。