gpt4 book ai didi

r - 无法在 Linux 中安装 R tseries、quadprog、xts 包

转载 作者:太空狗 更新时间:2023-10-29 11:49:32 26 4
gpt4 key购买 nike

我正在使用 R 版本 3.4.0

我正在尝试在 linux 机器上安装 tseries 包:

install.packages('https://cran.cnr.berkeley.edu/src/contrib/tseries_0.10-42.tar.gz',dependencies = TRUE,repos = NULL,type ="source")

It gives error:
ERROR: compilation failed for package 'xts'
* removing '/usr/lib64/R/library/xts'
ERROR: dependency 'xts' is not available for package 'TTR'
* removing '/usr/lib64/R/library/TTR'
ERROR: dependencies 'xts', 'TTR' are not available for package 'quantmod'
* removing '/usr/lib64/R/library/quantmod'
ERROR: dependencies 'quadprog', 'quantmod' are not available for package 'tseries'
* removing '/usr/lib64/R/library/tseries'

1: In install.packages("tseries", dependencies = TRUE) :
installation of package 'quadprog' had non-zero exit status
2: In install.packages("tseries", dependencies = TRUE) :
installation of package 'xts' had non-zero exit status
3: In install.packages("tseries", dependencies = TRUE) :
installation of package 'TTR' had non-zero exit status
4: In install.packages("tseries", dependencies = TRUE) :
installation of package 'quantmod' had non-zero exit status
5: In install.packages("tseries", dependencies = TRUE) :
installation of package 'tseries' had non-zero exit status

然后我尝试使用以下方法安装 quadprog:

install.packages('https://cran.cnr.berkeley.edu/src/contrib/quadprog_1.5-5.tar.gz',dependencies = TRUE,repos = NULL,type ="source")

它给出了错误:

/usr/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
make: *** [quadprog.so] Error 1
ERROR: compilation failed for package 'quadprog'
* removing '/usr/lib64/R/library/quadprog'

请帮忙看看我该怎么办。我在安装这些软件包时遇到了困难。

我已经安装了 R 使用:

sudo yum -y 安装 R-core R-devel

我尝试使用以下命令安装 gfortran:yum install gcc-gfortran

它说:包 gcc-gfortran-4.4.7-18.el6.x86_64 已经安装并且是最新版本无事可做

最佳答案

这里的问题是Fortran编译器(gfortran)和GCC编译器驱动(gcc)不同步:gfortran是版本 4.4.7,gcc 是版本 4.7.2。这意味着它们使用不同的目录来存储文件,并且 gcc 无法找到 gcc-gfortran 安装的 libgfortran.so 符号链接(symbolic link)> 包。

解决方案是将这两个编译器带到同一个版本。这可以通过调整 PATH 变量来实现(根据其他讨论,gcc 在这里不是指 /usr/bin/gcc),卸载提供此 gcc 命令的软件集合(使用 yum remove devtoolset-1.1-gcc),或为同一软件集合安装 Fortran 组件,使用 yum安装 devtoolset-1.1-gcc-gfortran

我最好的猜测是你的 devtoolset-1.1-gcc 包来自这个存储库:

因此您也可以从那里使用 gfortran 包(并选择 c++ 包,以避免类似的问题)。

关于r - 无法在 Linux 中安装 R tseries、quadprog、xts 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45292188/

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