首次在Mac上安装RStudio。为什么我不能安装任何包?

问题描述 投票:-1回答:1

在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’
r installation install.packages
1个回答
1
投票

错误消息告诉您缺少命令行工具。它们提供从源代码编译包所需的软件(例如,C和C ++编译器)。

您可以使用xcode-select --install as described here安装它们,或者如注释中所述,在提示从源代码编译时选择“否”。

© www.soinside.com 2019 - 2024. All rights reserved.