【发布时间】:2021-08-19 05:12:26
【问题描述】:
我安装了“tidyverse”,但显示错误。
Error: package or namespace load failed for ‘tidyverse’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘fansi’
所以我安装了“fansi”,它显示在下面。
> install.packages("fansi")
There is a binary version available but the source version is later:
binary source needs_compilation
fansi 0.4.2 0.5.0 TRUE
Do you want to install from sources the package which needs compilation? (Yes/no/cancel) yes
但我收到以下错误消息。
* installing *source* package ‘fansi’ ...
** package ‘fansi’ successfully unpacked and MD5 sums checked
** using staged installation
** 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/4.1/Resources/library/fansi’
Warning in install.packages :
installation of package ‘fansi’ had non-zero exit status
我尝试再次运行“tidyverse”,但仍然出现同样的错误。 你知道是什么原因造成的以及如何解决吗?
【问题讨论】:
-
您可能缺少 Rtools 程序 v2,尝试使用 cran.r-project.org/bin/windows/Rtools/rtools40v2-x86_64.exe 下载它
-
或者如果你在 mac 上运行它可能需要一些库来编译它,在这种情况下它看起来像 xcrun 尝试在你的终端上运行 xcode-select --install
-
如果你只想要 tidyverse 并且不关心最新的东西,只需选择“no”选项不从源代码编译,它应该下载版本 0.4.2 就好了
-
什么是 Xcode 以及如何安装它?我为“你想从源代码安装需要编译的包吗?”选择了“否”。这一次,又发生了一些冲突。
-
── 冲突 ──────── tidyverse_conflicts() ── x dplyr::filter() 屏蔽 stats::filter() x dplyr::lag() 屏蔽 stats::lag( )