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

Mac OS X下安装R包DescTools遇gfortran不存在错误求助

在Mac OS X上安装R包DescTools时因gfortran缺失导致依赖包编译失败

我在Mac OS X系统中尝试安装R语言的DescTools包,安装过程中需要编译依赖包lmom和gld,但出现了无法解决的错误。从报错信息来看,问题根源是系统找不到gfortran工具,我已经通过谷歌搜索相关解决方案,但仍未解决。

以下是完整的报错输出:

> install.packages("DescTools")
Installing package into ‘/Users/XXX/Library/R/4.0/library’
(as ‘lib’ is unspecified)
also installing the dependencies ‘lmom’, ‘gld’
There are binary versions available but the source versions are later:
        binary  source needs_compilation
lmom          2.8     2.9              TRUE
gld         2.6.4   2.6.6              TRUE
DescTools 0.99.44 0.99.47              TRUE

Do you want to install from sources the packages which need compilation? (Yes/no/cancel) Yes
installing the source packages ‘lmom’, ‘gld’, ‘DescTools’

installing *source* package ‘lmom’ ...
** package ‘lmom’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls  -fPIC  -Wall -g -O2  -c d1mach.f -o d1mach.o
make: gfortran: No such file or directory
make: *** [d1mach.o] Error 1
ERROR: compilation failed for package ‘lmom’
removing ‘/Users/XXX/Library/R/4.0/library/lmom’
Warning in install.packages :
  installation of package ‘lmom’ had non-zero exit status
ERROR: dependency ‘lmom’ is not available for package ‘gld’
removing ‘/Users/XXX/Library/R/4.0/library/gld’
Warning in install.packages :
  installation of package ‘gld’ had non-zero exit status
ERROR: dependency ‘gld’ is not available for package ‘DescTools’
removing ‘/Users/XXX/Library/R/4.0/library/DescTools’
Warning in install.packages :
  installation of package ‘DescTools’ had non-zero exit status

The downloaded source packages are in
‘/private/var/folders/fr/3xrgrwbd44vf58dqqtcml67h0000gn/T/RtmpOmArkk/downloaded_packages’

恳请各位提供可行的解决方法,谢谢!

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.15 10:00:57