rJava不能在macOS Sierra上运行

时间:2017-07-27 13:14:28

标签: r rstudio macos-sierra rjava

我正在使用macOS Sierra和R版本3.4.0。 我使用RStudio安装了包“rJava”:

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时,我得到:

> 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

1 个答案:

答案 0 :(得分:1)

R,rJava和Java在macOS中有点乱。通常,您必须确保正确配置所有元素。甲骨文和苹果版本之间存在冲突。

请点击此处查看非常详细的说明:R, Java, rJava and macOS adventures

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