在Mac El Capitan上安装和加载rJava时遇到问题 [英] trouble installing and loading rJava on mac El Capitan
问题描述
在安装rJava时遇到问题,尝试了大多数故障排除步骤此处,并且没有"工作.
Have issue installing rJava, tried most troubleshooting steps here and doesn't work.
返回错误
Loading required package: rJava
Error: package or namespace load failed for 'rJava':
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/ rJava.so':
我正在使用R/Rstudio和Mac El Capitan的最新版本
I'm on latest ver of R/Rstudio and Mac El Capitan
我也尝试了这种方法1无效
I also tried this method 1 which didn't work
sudo R CMD javareconf
然后,在R解释器中:
install.packages('rJava', type='source')
install.packages('xlsx', type='source')
方法2
sudo ln -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib
返回错误ln:/usr/local/lib/libjvm.dylib:文件存在
error returned ln: /usr/local/lib/libjvm.dylib: File exists
方法3 install.packages("rJava",type ="binary") 错误:tar:无法设置默认语言环境
method 3 install.packages("rJava", type = "binary") error: tar: Failed to set default locale
处理默认语言环境错误
system("defaults write org.R-project.R force.LANG en_US.UTF-8")
在加载rJava时,仍然出现相同的错误:
upon loading rJava, still same error:
image not found
因此看起来它已安装但无法加载
So looks like it's installed but won't load
推荐答案
问题是rJava无法安装在RStudio
(Version 1.0.136
)中.以下内容对我有用(macOS Sierra version 10.12.6
)(在此处找到):
The problem was rJava wont install in RStudio
(Version 1.0.136
). The following worked for me (macOS Sierra version 10.12.6
) (found here):
第1步:从此处下载并安装javaforosx.dmg
Step-1: Download and install javaforosx.dmg
from here
步骤2:接下来,从RStudio内部运行命令:
Step-2: Next, run the command from inside RStudio:
install.packages("rJava", type = 'source')
这篇关于在Mac El Capitan上安装和加载rJava时遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!