本文介绍了rJava无法在macOS Sierra上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用macOS Sierra和R版本3.4.0.我使用RStudio安装了软件包"rJava":

I am using macOS Sierra and R version 3.4.0.I installed the package "rJava" using RStudio:

install.packages("rJava")
Warning in install.packages :
  cannot open URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.4/PACKAGES.rds': HTTP status was '404 Not Found'
trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.4/rJava_0.9-8.tgz'
Content type 'application/x-gzip' length 627959 bytes (613 KB)
==================================================
downloaded 613 KB


The downloaded binary packages are in
    /var/folders/tq/f5jbfqp97y52w_y7byn05_fw0000gn/T//RtmpTdEVbA/downloaded_packages

然后,当我尝试运行rJava时,我得到了:

Then when I try to run rJava I get:

> require(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.4/Resources/library/rJava/libs/rJava.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: @rpath/libjvm.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so
  Reason: image not found

推荐答案

R,rJava和Java在macOS中有点混乱.通常,您必须确保正确配置所有元素. Oracle版本和Apple版本之间存在冲突.

R, rJava and Java are little bit messy in macOS. In general, you have to make sure to properly configure all the elements. There is a clash between Oracle's and Apple's version.

在这里查看非常详细的说明: R,Java,rJava和macOS冒险

Take a look here for very detailed instructions: R, Java, rJava and macOS adventures

我不在这里发布内容-它很长.

I don't post the content here - it's quite long.

这篇关于rJava无法在macOS Sierra上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-05 20:27