[R / Rstudio中的rJava加载在升级到OSX Catalina之后失败

问题描述 投票:4回答:2

我最近将OSX从Mojave升级到Catalina。升级后,我无法在Rstudio中运行JGR()软件包,因为无法加载rJava。我反复收到错误:

    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.6/Resources/library/rJava/libs/rJava.so':
      dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/r        .Java/libs/rJava.so, 6): Library not loaded:         /Library/Java/JavaVirtualMachines/jdk-        11.0.1.jdk/Contents/Home/lib/server/libjvm.dylib
      Referenced from:         /Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/li        .bs/rJava.so
      Reason: image not found
    Error: package ‘rJava’ could not be loaded

上次遇到此问题(在OSX Mojave中,我使用“ install.packages(” data“,type =” binary“)安装了所有软件包,但是这次不能解决问题。

有人可以帮助我解决此问题吗?任何解决方案如何进行?

r installation rstudio rjava macos-catalina
2个回答
1
投票

更新Catalina之后,我遇到了同样的问题。我尝试了许多在线发布的方法,但都无效。

根据错误消息,在Catalina下的Rstudio似乎只能运行JDK11.0.1。因此,我卸载了JDK13.0.4,然后安装了旧版本JDK11.0.1,它对我有用。

也许您可以尝试安装JDK11.0.1


1
投票

从莫哈韦沙漠升级到卡塔琳娜州后,我遇到了同样的问题。长话短说,这是唯一对我有用的解决方案:

install_name_tool -change /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/lib/server/libjvm.dylib \
/Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home/jre/lib/server/libjvm.dylib \
/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/libs/rJava.so
© www.soinside.com 2019 - 2024. All rights reserved.