在macOS 10.14上rJava安装失败 [英] rJava installation fails on macOS 10.14
问题描述
升级到MacOS Mojave(10.14.1)后,对于安装了Java版本"1.8.0_102"的R版本3.5.1,我不再能够安装rJava
.
After upgrading to MacOS Mojave (10.14.1), I'm no longer able to install rJava
for R version 3.5.1 with Java version "1.8.0_102" installed.
我尝试了适用于MacOS 10.11的先前解决方案,但仍然无法正常工作,并出现以下错误:
I tried the previous solution for MacOS 10.11 but it still did not work, giving this error:
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.5/Resources/library/rJava/libs/rJava.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/lib/server/libjvm.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so
Reason: image not found
推荐答案
发布我发现的解决方案,以防它对其他人有帮助-我不太明白为什么这样做有效,或者它是否是正确的方法,因此正在寻找更好的替代方案!
Posting the solution I found in case it helps others -- I don't quite understand why this work or if it's the right way so looking for better alternatives!
此问题导致
对于在/usr/include下的基本系统中查找macOS标头的旧版软件,请安装位于/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14的软件包文件. pkg
For legacy software that looks for the macOS headers in the base system under /usr/include, please install the package file located at: /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14. pkg 为此,请打开终端并运行以下命令 To do this, open terminal and run these commands 然后按照提示安装软件包. then follow prompts to install the package. 然后,在终端中,按照上一个答案配置rJava并安装 After this, in the terminal, configure rJava and install as in the previous answer ,它应该安装没有问题. and it should install without problem. 这篇关于在macOS 10.14上rJava安装失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
cd /Library/Developer/CommandLineTools/Packages/
open macOS_SDK_headers_for_macOS_10.14.pkg
sudo R CMD javareconf
R -e "install.packages('rJava')"