在OS X中安装Rcmdr/car/quantreg软件包 [英] Installing Rcmdr/car/quantreg packages in OS X
问题描述
尝试在Mac(Yosemite 10.10.4)中安装 Rcmdr
(R版本3.2.2)程序包时,我遇到了一些问题:
Trying to install the Rcmdr
(R version 3.2.2) package in my Mac (Yosemite 10.10.4), I ran into a few problems:
- 在安装了Rcmdr及其所有依赖项之后,当我尝试加载程序包时会得到以下信息:
正在加载所需的软件包:RcmdrMisc
正在加载所需的包裹:汽车
loadNamespace(j<-i [[1L]],c(lib.loc,.libPaths()),versionCheck = vI [[j]])中的错误:没有名为"quantreg"的软件包错误:无法加载汽车"包
Loading required package: RcmdrMisc
Loading required package: car
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : there is no package called ‘quantreg’ Error: package ‘car’ could not be loaded
- 所以我尝试安装
car
软件包及其依赖项quantreg
软件包,这就是发生的情况:
- So I tried to install the
car
package along with its dependency, thequantreg
package, and this is what happens:
**软件包"quantreg"已成功解压,并检查了MD5的总和**库gfortran-4.8 -fPIC -g -O2 -c akj.f -o akj.o
make:gfortran-4.8:没有这样的文件或目录
make:*** [akj.o]错误1
错误:软件包"quantreg"的编译失败
* 移除‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/quantreg’
install.packages中的警告:
软件包"quantreg"的安装具有非零退出状态
** package ‘quantreg’ successfully unpacked and MD5 sums checked ** libs gfortran-4.8 -fPIC -g -O2 -c akj.f -o akj.o
make: gfortran-4.8: No such file or directory
make: *** [akj.o] Error 1
ERROR: compilation failed for package ‘quantreg’
* removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/quantreg’
Warning in install.packages :
installation of package ‘quantreg’ had non-zero exit status
- 然后我意识到问题可能是fortran编译器.我没有4.8版本,但我将gfortran-4.8链接到我的gfortran-5.0,但无法解决问题:
ld:警告:找不到选项'-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2'的目录
ld:警告:找不到选项'-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2'的目录
ld:找不到-lquadmath的库
clang:错误:链接器命令失败,退出代码为1(使用-v查看调用)
make:*** [quantreg.so]错误1
错误:软件包"quantreg"的编译失败
*删除"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/quantreg"
ld: warning: directory not found for option '-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2'
ld: warning: directory not found for option '-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2'
ld: library not found for -lquadmath
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [quantreg.so] Error 1
ERROR: compilation failed for package ‘quantreg’
* removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/quantreg’
如果有人可以帮助我解决这个问题,我将非常感激.
I would be very grateful if someone could help me get to the bottom of this problem.
推荐答案
这是我解决的方法.[OSX Mojave,R 4.0.2]
Here is how I solved it. [OSX Mojave, R 4.0.2]
我希望它能对您有所帮助,尤其是对于那些无法通过此处提供的答案解决它的人:
I hope it helps, especially for those who could not solve it with the answers provided here: OS X package installation depends on gfortran-4.8
-
确保将R更新到版本> = 4.0(对于以前的版本,这可能会有所帮助: https://cran.ism.ac.jp/bin/macosx/tools/)
在此处下载并安装GNU fortran编译器: https://mac.r-project.org/tools/
Download and install the GNU fortran compiler found here: https://mac.r-project.org/tools/
请确保将/usr/local/gfortran/bin添加到PATH,以便使用此编译器.可以做到这一点,例如由
Make sure you add /usr/local/gfortran/bin to your PATH in order to use this compiler. This can be done, e.g. by
export PATH = $ PATH:/usr/local/gfortran/bin
export PATH=$PATH:/usr/local/gfortran/bin
这篇关于在OS X中安装Rcmdr/car/quantreg软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!