在 R 4.1.2 中的 Mac 上安装 R‘greenbrown’包

在 R 4.1.2 中的 Mac 上安装 R‘greenbrown’包

我最近从 Windows 切换到 Mac,我需要使用“greenbrown”包来运行一些代码。但是,当我尝试按照在线说明进行安装时,我收到错误,我认为这些错误与 gfortran 有关?我尝试从 tar.gz 安装“strucchange”,但没有帮助。命令:

install.packages("greenbrown", repos="http://R-Forge.R-project.org")

错误消息:

ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0' 
ld: warning: directory not found for option '-L/usr/local/gfortran/lib' 
ld: library not found for -lgfortran clang: error: linker command failed with exit code 1 (use -v to see invocation) 
make: *** [strucchange.so] Error 1 
ERROR: compilation failed for package ‘strucchange’ removing ‘/Library/Frameworks/R.framework/Versions/4.1/Resources/library/strucchange’ 
Warning in install.packages : installation of package ‘strucchange’ had non-zero exit status 
ERROR: dependencies ‘strucchange’, ‘forecast’ are not available for package ‘bfast’ removing ‘/Library/Frameworks/R.framework/Versions/4.1/Resources/library/bfast’ 
Warning in install.packages : installation of package ‘bfast’ had non-zero exit status 
ERROR: dependencies ‘SDMTools’, ‘jpeg’, ‘bcp’, ‘strucchange’ are not available for package ‘phenopix’ removing ‘/Library/Frameworks/R.framework/Versions/4.1/Resources/library/phenopix’ Warning in install.packages : installation of package ‘phenopix’ had non-zero exit status 
ERROR: dependencies ‘strucchange’, ‘Kendall’, ‘bfast’, ‘phenopix’, ‘quantreg’ are not available for package ‘greenbrown’ removing ‘/Library/Frameworks/R.framework/Versions/4.1/Resources/library/greenbrown’ 
Warning in install.packages : installation of package ‘greenbrown’ had non-zero exit status

答案1

尝试这个,

步骤1 重新安装

brew reinstall gcc

步骤2 检查警告信息中提到的目录。如果不存在,请创建它们。复制 gfortran 库.../lib/gcc/x/到目录。

步骤3 重试安装包。

相关内容