无法安装包车

Unable to install package car

我在 Linux mint 17.3 64 位中使用 R 版本 3.2.3。我试图用 dependencies=TRUE 安装软件包 "car",但安装失败并显示以下错误消息:

> warnings()
Warning messages:
1: In install.packages("car", dependencies = T) :
installation of package ‘minqa’ had non-zero exit status
2: In install.packages("car", dependencies = T) :
installation of package ‘RcppEigen’ had non-zero exit status
3: In install.packages("car", dependencies = T) :
installation of package ‘leaps’ had non-zero exit status
4: In install.packages("car", dependencies = T) :
installation of package ‘lmtest’ had non-zero exit status
5: In install.packages("car", dependencies = T) :
installation of package ‘rgl’ had non-zero exit status
6: In install.packages("car", dependencies = T) :
installation of package ‘SparseM’ had non-zero exit status
7: In install.packages("car", dependencies = T) :
installation of package ‘quantreg’ had non-zero exit status
8: In install.packages("car", dependencies = T) :
installation of package ‘lme4’ had non-zero exit status
9: In install.packages("car", dependencies = T) :
installation of package ‘effects’ had non-zero exit status
10: In install.packages("car", dependencies = T) :
installation of package ‘pbkrtest’ had non-zero exit status
11: In install.packages("car", dependencies = T) :
installation of package ‘car’ had non-zero exit status
12: In install.packages("car", dependencies = T) :
installation of package ‘alr4’ had non-zero exit status

我该如何解决这个问题?请帮忙

我终于找到了解决办法。查看安装 "minqa" 的错误消息后,我意识到安装程序无法找到 gfortran。所以我安装了 gfortran,然后再次尝试安装 "car"。这次我收到另一条错误消息,说 -llapack -lblas 没有找到。因此,根据这个link:/usr/bin/ld: cannot find -llapack 我安装了软件包 "liblapack-dev""liblapack3""libopenblas-base""libopenblas-dev"。之后,"car"包就安装成功了。

安装 r-cran-car

在 Ubuntu 16.04 (Xenial Xerus) 上安装 r-cran-car 包就像 运行 在终端上执行以下命令一样简单:

sudo apt-get 更新

sudo apt-get 安装 r-cran-car

我遇到了同样的问题。就我而言,在我的机器上安装 gcc-fortran 就足够了。

如果您使用的是 Anaconda,请考虑通过 conda 安装 gfortran 软件包。例如,on Mac:

conda install -c anaconda gfortran_osx-64 

浏览 install.packages("car") 的输出时,出现以下错误消息:

/bin/bash: gfortran: command not found
/usr/bin/ld: cannot find -llapack
/usr/bin/ld: cannot find -lblas

将相关包添加到我的Ubuntu系统后,一切正常。

sudo apt-get install gfortran liblapack-dev libblas-dev