在Windows PC上工作多年后,我已经在Mac上成功安装了RStudio。不用说,软件包安装是我的下一步,但是每当我尝试安装软件包时,都会返回错误。当我尝试安装软件包依赖项时发生错误...为了简化起见,在此示例中,我将使用“ tibble”软件包。
请原谅我的新手编码性质,我仍然每天都在学习。
我尝试安装不同的软件包(这些软件包全部来自CRAN),并且每次都会出现相同的结果。
编辑:分别输入“ no”,“ yes”将安装软件包。有人知道为什么我仍然收到此输出吗?不必一次安装一个软件包,那就太好了。谢谢!
> install.packages("tibble")
> y
> y
我希望安装成功,但是实际输出如下:
> install.packages("tibble")
also installing the dependencies ‘utf8’, ‘fansi’, ‘pillar’, ‘rlang’
There are binary versions available but the source versions are later:
binary source needs_compilation
utf8 1.1.3 1.1.4 TRUE
pillar 1.0.1 1.3.1 FALSE
rlang 0.1.6 0.3.4 TRUE
tibble 1.3.4 2.1.1 TRUE
Do you want to install from sources the packages which need compilation?
y/n: y
Package which is only available in source form, and may need compilation of
C/C++/Fortran: ‘fansi’
Do you want to attempt to install these from sources?
y/n: y
installing the source packages ‘utf8’, ‘fansi’, ‘pillar’, ‘rlang’, ‘tibble’
trying URL 'https://cran.rstudio.com/src/contrib/utf8_1.1.4.tar.gz'
Content type 'application/x-gzip' length 218882 bytes (213 KB)
==================================================
downloaded 213 KB
trying URL 'https://cran.rstudio.com/src/contrib/fansi_0.4.0.tar.gz'
Content type 'application/x-gzip' length 266123 bytes (259 KB)
==================================================
downloaded 259 KB
trying URL 'https://cran.rstudio.com/src/contrib/pillar_1.3.1.tar.gz'
Content type 'application/x-gzip' length 103972 bytes (101 KB)
==================================================
downloaded 101 KB
trying URL 'https://cran.rstudio.com/src/contrib/rlang_0.3.4.tar.gz'
Content type 'application/x-gzip' length 858992 bytes (838 KB)
==================================================
downloaded 838 KB
trying URL 'https://cran.rstudio.com/src/contrib/tibble_2.1.1.tar.gz'
Content type 'application/x-gzip' length 311836 bytes (304 KB)
==================================================
downloaded 304 KB
Warning in strptime(xx, f <- "%Y-%m-%d %H:%M:%OS", tz = tz) :
unknown timezone 'zone/tz/2018i.1.0/zoneinfo/America/New_York'
* installing *source* package ‘utf8’ ...
** package ‘utf8’ successfully unpacked and MD5 sums checked
** libs
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
ERROR: compilation failed for package ‘utf8’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/utf8’
Warning in install.packages :
installation of package ‘utf8’ had non-zero exit status
Warning in strptime(xx, f <- "%Y-%m-%d %H:%M:%OS", tz = tz) :
unknown timezone 'zone/tz/2018i.1.0/zoneinfo/America/New_York'
* installing *source* package ‘fansi’ ...
** package ‘fansi’ successfully unpacked and MD5 sums checked
** libs
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
ERROR: compilation failed for package ‘fansi’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/fansi’
Warning in install.packages :
installation of package ‘fansi’ had non-zero exit status
Warning in strptime(xx, f <- "%Y-%m-%d %H:%M:%OS", tz = tz) :
unknown timezone 'zone/tz/2018i.1.0/zoneinfo/America/New_York'
* installing *source* package ‘rlang’ ...
** package ‘rlang’ successfully unpacked and MD5 sums checked
** libs
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
ERROR: compilation failed for package ‘rlang’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rlang’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rlang’
Warning in install.packages :
installation of package ‘rlang’ had non-zero exit status
Warning in strptime(xx, f <- "%Y-%m-%d %H:%M:%OS", tz = tz) :
unknown timezone 'zone/tz/2018i.1.0/zoneinfo/America/New_York'
ERROR: dependencies ‘fansi’, ‘utf8’ are not available for package ‘pillar’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/pillar’
Warning in install.packages :
installation of package ‘pillar’ had non-zero exit status
Warning in strptime(xx, f <- "%Y-%m-%d %H:%M:%OS", tz = tz) :
unknown timezone 'zone/tz/2018i.1.0/zoneinfo/America/New_York'
ERROR: dependencies ‘fansi’, ‘pillar’ are not available for package ‘tibble’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/tibble’
Warning in install.packages :
installation of package ‘tibble’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/sn/zj2b1gqx6wsfs76h5mymrk_r0000gn/T/RtmpqBjXKW/downloaded_packages’
答案 0 :(得分:1)
错误消息告诉您缺少命令行工具。它们提供了从源代码编译软件包所需的软件(例如C和C ++编译器)。
您可以使用xcode-select --install
as described here安装它们,或者如注释中所述,在提示从源代码进行编译时选择“否”。