You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

求助:无法在RStudio中安装tidyverse包的问题排查

问题

在RStudio中执行代码:

install.packages("tidyverse")

出现以下错误信息:

Execution halted
ERROR: lazy loading failed for package ‘dtplyr’

  • removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/dtplyr’
    ERROR: dependency ‘broom’ is not available for package ‘modelr’
  • removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/modelr’
    ERROR: dependencies ‘broom’, ‘dbplyr’, ‘dtplyr’, ‘googlesheets4’, ‘modelr’, ‘rvest’ are not available for package ‘tidyverse’
  • removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/tidyverse’

The downloaded source packages are in
‘/private/var/folders/dp/4s8zzfmn11v13_xvl38yygcr0000gn/T/RtmpSbkirG/downloaded_packages’
There were 15 warnings (use warnings() to see them)

同一版本的R在PC上可正常安装tidyverse,但在Mac笔记本上安装失败。

解决方法
  • 手动安装缺失依赖:先逐个安装报错中提到的依赖包,同时自动安装次级依赖:

    install.packages(c("broom", "dbplyr", "dtplyr", "googlesheets4", "modelr", "rvest"), dependencies = TRUE)
    

    完成后再执行install.packages("tidyverse")。

  • 安装Mac编译工具:Mac系统缺少Xcode命令行工具会导致R包编译失败,打开终端执行:

    xcode-select --install
    

    安装完成后重启RStudio再尝试安装。

  • 切换CRAN镜像:镜像源不稳定可能导致包下载不完整,在RStudio中通过Tools -> Global Options -> Packages切换到国内稳定镜像(如清华大学镜像),重新执行安装命令。

  • 确认R版本兼容性:执行sessionInfo()查看当前R版本,确保为最新稳定版(4.3.x及以上),部分tidyverse依赖包对R版本有要求,若版本过低,重新安装最新版R。

内容的提问来源于stack exchange,提问作者biglig

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.09 03:46:11