我无法在Mac OS 10.11.5上运行R xlsx软件包-El Capitan [英] I cannot run R xlsx package on my Mac OS 10.11.5 - El Capitan

查看:234
本文介绍了我无法在Mac OS 10.11.5上运行R xlsx软件包-El Capitan的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在R上运行xlsx软件包,但返回此错误:

I'm trying to run the xlsx package on R but returns this error:

> library(xlsx)
JavaVM: requested Java version ((null)) not available. Using Java at "" instead.
JavaVM: Failed to load JVM: /bundle/Libraries/libserver.dylib
JavaVM FATAL: Failed to load the jvm library.
Error : .onLoad failed in loadNamespace() for 'xlsx', details:
 call: .jinit()
 error: JNI_GetCreatedJavaVMs returned -1

Error: package or namespace load failed for ‘xlsx’

我在Stackoverflow上找到了此链接无法加载Mac OS 10.11上的R xlsx软件包,但不适用于我.

I found this link here on Stackoverflow Cannot load R xlsx package on Mac OS 10.11 but it isn't working for me.

解决方案是在Mac终端上运行sudo R CMD javareconf,然后在R上运行install.packages("rJava",type='source')之后.但是,当我运行sudo R CMD javareconf时,我的Mac会出现此错误:sudo: R: command not found.

The solution was to run sudo R CMD javareconf on Mac Terminal and after install.packages("rJava",type='source') on R. But when I run sudo R CMD javareconf my Mac gives this error: sudo: R: command not found.

有人知道我该如何解决这个问题?

Does anyone know how can I fix this issue?

操作系统版本:

$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.11.5
BuildVersion:   15F34

Java版本:

$ java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

R版本:

> version
           _                           
platform       x86_64-apple-darwin13.4.0   
arch           x86_64                      
os             darwin13.4.0                
system         x86_64, darwin13.4.0        
status                                     
major          3                           
minor          2.3                         
year           2015                        
month          12                          
day            10                          
svn rev        69752                       
language       R                           
version.string R version 3.2.3 (2015-12-10)
nickname       Wooden Christmas-Tree

推荐答案

Terminal会话中的错误消息实际上表明您的bash PATH没有R可执行文件的目录(或指向它的符号链接).我还想知道增加PATH值是否会成功.

The error message from your Terminal session actually suggest that your bash PATH does not have the directory for the R executable (or a symlink to it.) But I'm also wondering if augmenting your PATH value will be successful.

El Capitan版本的OSX更改了安全策略,并移动了用户安装的软件的位置.通过在终端提示符下发出以下命令并输入密码,使javareconf失败后,我获得了成功:

The El Capitan version of OSX changed the security policies and move the location for user installed software. I got success after failing with javareconf by issuing this command at a Terminal prompt and then giving my password:

sudo ln -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib

这篇关于我无法在Mac OS 10.11.5上运行R xlsx软件包-El Capitan的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆