在 Mac 上找不到已安装的 gfortran 软件包

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

我运行的是 MacOS Ventura 13.6.7。我想使用RStudio安装nlme R包,这需要编译。当我尝试安装它时,出现以下错误:

installing the source package ‘nlme’

trying URL 'https://cran.rstudio.com/src/contrib/nlme_3.1-165.tar.gz'
Content type 'application/x-gzip' length 856244 bytes (836 KB)
==================================================
downloaded 836 KB

* installing *source* package ‘nlme’ ...
** package ‘nlme’ 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 chol.f -o chol.o
make: gfortran: No such file or directory
make: *** [chol.o] Error 1
ERROR: compilation failed for package ‘nlme’
* removing ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/nlme’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/nlme’
Warning in install.packages :
  installation of package ‘nlme’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/p2/2rwngv010yx_0mxq1yd573zm0000gn/T/RtmpXRKSJE/downloaded_packages’

我已从此链接下载并安装了 gfortran:https://mac.r-project.org/tools/gfortran-12.2-universal.pkg.

安装在这里:/opt/gfortran/bin/gfortran

但是,我仍然收到错误。

r macos gfortran nlme
1个回答
1
投票

我认为你应该从

here
安装 gfortran;这是来自 R for MacOS X 开发工具和库 页面。此版本将安装到 /usr/local/gfortran 中,并将最大限度地提高
gfortran
位于正确位置并被 R 编译工具找到的机会。

(对我来说,为什么需要从源代码编译并不明显;https://cran.r-project.org/package=nlme 为大多数 MacOS 平台提供二进制文件。)

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