问题描述
在我的Mac上安装rjava真是个噩梦。
Its being a real nightmare to install rjava on my Mac.
我的设置:
MacOS 10.9.5
Java: 7u71 (64 bits dowloaded from Oracle site)
R: R version 3.1.1 (2014-07-10)
首先,在命令行中我运行了
First, in the command line I ran the
sudo R CMD javareconf
然后,我跑进了R:
install.packages('rJava')
编译结束时的错误是:
JavaVM -F/opt/local/Library/Frameworks/R.framework/.. -framework R -llzma -lm -liconv -licuuc -licui18n
ld: library not found for -licuuc
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [libjri.jnilib] Error 1
make[1]: *** [src/JRI.jar] Error 2
make: *** [jri] Error 2
ERROR: compilation failed for package ‘rJava’
* removing ‘/Users/costa/Library/R/3.1/library/rJava’
我尝试了Java 8和Mac默认java并且也得到了同样的错误。
I tried Java 8 and the Mac default java and also got the same error.
Ideias?
推荐答案
我做了什么(使用macports R) root(sudo bash):
What I did (using macports R) as root (sudo bash):
-
编辑
/ opt / local / Library / Frameworks /R.framework/Resources/etc/Makeconf
并更改行
edit
/opt/local/Library/Frameworks/R.framework/Resources/etc/Makeconf
and change the line
LIBS = -llzma -lm -liconv -licuuc -licui18n
to
LIBS = -llzma -lm -liconv
安装原始1.6 Mac Java
install the original 1.6 Mac Java
export
JAVA_HOME = / System / Library / Java / JavaVirtualMachines /1.6.0.jdk/Contents/Home
运行 R CMD javareconf
现在你可以启动R并执行 install.packages(rJava )
。使用1.6版本的Java确保RStudio也可以加载rJava包。
Now you can start R and do a install.packages("rJava")
. Using the 1.6 version of Java made sure that also RStudio can load the rJava package.
如果你不打算使用RStudio,你也可以使用Java 1.8
If you do not plan using RStudio, you can also use Java 1.8
这篇关于在macOS Mavericks 10.9.5上安装xlsx和rJava的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!