gpt4 book ai didi

r - 在 R 版本 3.3.2 中安装 'forecast' 包时出错

转载 作者:行者123 更新时间:2023-12-01 19:53:44 26 4
gpt4 key购买 nike

尝试在 MacOS Sierra 上的 R 版本 3.3.2 中安装“预测”包,如下所示:

install.packages("forecast")

出现一系列我不明白的错误。首先它从 http://cloud.r-project.org 下载所有依赖包。我得到的第一个错误是这样的:

* installing *source* package ‘quadprog’ ...
** package ‘quadprog’ successfully unpacked and MD5 sums checked
** libs
gfortran -arch x86_64 -fPIC -g -O2 -c aind.f -o aind.o
make: gfortran: No such file or directory
make: *** [aind.o] Error 1
ERROR: compilation failed for package ‘quadprog’
* removing ‘/Users/ekorne201/Library/R/3.3/library/quadprog’

然后继续:

* installing *source* package ‘fracdiff’ ...
** package ‘fracdiff’ successfully unpacked and MD5 sums checked

之后说:

ld: warning: directory not found for option '-L/Users/Shared/Jenkins/workspace/External-R-3.3.2/vendor/build/lib'
ld: warning: directory not found for option '-L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3/x86_64'
ld: warning: directory not found for option '-L/usr/local/lib/x86_64'
ld: warning: directory not found for option '-L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [fracdiff.so] Error 1
ERROR: compilation failed for package ‘fracdiff’
* removing ‘/Users/ekorne201/Library/R/3.3/library/fracdiff’

对“lmtest”和“RcppArmadillo”执行相同的操作,然后以以下内容结束:

 ERROR: dependencies ‘tseries’, ‘fracdiff’, ‘lmtest’, ‘RcppArmadillo’ are not available for package ‘forecast’
* removing ‘/Users/ekorne201/Library/R/3.3/library/forecast’

The downloaded source packages are in
‘/private/var/folders/8p/54qnlb9x7bj8syz631_d58t92rmkyp/T/Rtmp246ipQ/downloaded_packages’
Warning messages:
1: In install.packages("forecast") :
installation of package ‘quadprog’ had non-zero exit status
2: In install.packages("forecast") :
installation of package ‘fracdiff’ had non-zero exit status
3: In install.packages("forecast") :
installation of package ‘lmtest’ had non-zero exit status
4: In install.packages("forecast") :
installation of package ‘RcppArmadillo’ had non-zero exit status
5: In install.packages("forecast") :
installation of package ‘tseries’ had non-zero exit status
6: In install.packages("forecast") :
installation of package ‘forecast’ had non-zero exit status

不知道如何继续,希望得到建议。

最佳答案

我遇到了同样的错误。我通过安装 gfortran 解决了这个问题。在 macOS 中,我可以这样做

brew install gcc 

在 R 中这样

install.packages("forecast")

所以

> library(forecast); fit <- tbats(UScitiesD);
> fit
BATS(0.566, {0,2}, -, -)

Call: tbats(y = UScitiesD)

Parameters
Lambda: 0.565592
Alpha: 0.2166945
MA coefficients: -0.130506 -0.511551

Seed States:
[,1]
[1,] 90.10291
[2,] 0.00000
[3,] 0.00000

Sigma: 27.61468
AIC: 761.9238

正如评论中提到的,其他方法是从 here 安装它.

相关

  1. Does installing gfortran with homebrew and with an installer create a conflict?

关于r - 在 R 版本 3.3.2 中安装 'forecast' 包时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42959361/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com