我正在尝试在R-3.5.1中安装curl
软件包。我在Mac OSX 10.13.6上,使用Homebrew作为我的软件包管理器。例如
> install.packages("curl")
Installing package into ‘/Users/user/.R/3.5.1-lib’
(as ‘lib’ is unspecified)
trying URL 'https://ftp.osuosl.org/pub/cran/src/contrib/curl_3.2.tar.gz'
Content type 'application/x-gzip' length 367047 bytes (358 KB)
==================================================
downloaded 358 KB
Looking for libraries in : ~/.R/3.5.1-lib....
* installing *source* package ‘curl’ ...
** package ‘curl’ successfully unpacked and MD5 sums checked
Found pkg-config cflags and libs!
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 ‘/Users/user/.R/3.5.1-lib/curl’
The downloaded source packages are in
‘/private/var/folders/0s/qch_8kr55x91vgc08sfvh82w0000gn/T/RtmpP4GQji/downloaded_packages’
Warning message:
In install.packages("curl") :
installation of package ‘curl’ had non-zero exit status
>
按照他们的建议,我将libcurl放在合理的系统级别目录/usr/lib
中,即
$ find /usr/ -name "*libcurl*" -print
find: /usr//sbin/authserver: Permission denied
/usr//local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.8/libcurl.pc
/usr//local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.9/libcurl.pc
/usr//local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.10/libcurl.pc
/usr//local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.11/libcurl.pc
/usr//local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.5/libcurl.pc
/usr//local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.14/libcurl.pc
/usr//local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.13/libcurl.pc
/usr//local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.12/libcurl.pc
/usr//lib/libcurl.dylib
/usr//lib/libcurl.4.dylib
/usr//lib/libcurl.3.dylib
我有pkg-config
,即
$ which pkg-config
/usr/local/bin/pkg-config
我还设置了PKG_CONFIG_PATH
,即
$ echo $PKG_CONFIG_PATH
/usr//local/Homebrew/Library/Homebrew/os/mac/pkgconfig/
我也直接尝试了建议设置INCLUDE_DIR
和LIB_DIR
,即
$ R CMD INSTALL --configure-vars='INCLUDE_DIR=/usr/include/curl/ LIB_DIR=/usr/lib' curl
Looking for libraries in : ~/.R/3.5.1-lib....
Warning: invalid package ‘curl’
Error: ERROR: no packages specified
我在这里完全不知所措。我不熟悉在OSX上进行开发,所以也许我在这里遗漏了一些东西。回顾以前的R-3.4.2安装,看来我以前安装此软件包没有困难。
问题:如何安装curl
软件包?这个question似乎相关,但是适用于Linux。