在 Mac 上安装 RWeka

标签 r macos

我正在尝试在 mac 上安装 RWeka 包。

操作系统版本:

10.9.5



安装的Java版本:

java version "1.7.0_75"
Java(TM) SE Runtime Environment (build 1.7.0_75-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.75-b04, mixed mode)



执行后

install.packages("RWeka")



当我尝试执行

library(RWeka)



显示以下错误

Error : .onLoad failed in loadNamespace() for 'RWekajars', details:
call: .jinit()
error: JNI_GetCreatedJavaVMs returned -1

Error: package or namespace load failed for ‘RWeka’
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.



命令的输出

R CMD javareconf





xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.
xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.
xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.
xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.
xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.
Java interpreter : /usr/bin/java
Java version : 1.7.0_75
Java home path : /Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home/jre
Java compiler : /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar
Non-system Java on OS X

trying to compile and link a JNI program
detected JNI cpp flags : -I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/darwin
detected JNI linker flags : -L/Users/amlanroy/Library/Java/Extensions -L/Library/Java/Extensions -L/Network/Library/Java/Extensions -L/System/Library/Java/Extensions -L/usr/lib/java -L. -ljvm
xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.
Unable to compile a JNI program

JAVA_HOME : /Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home/jre
Java library path:
JNI cpp flags :
JNI linker flags :
Updating Java configuration in /Library/Frameworks/R.framework/Resources
Done.



请让我知道是否有人遇到过同样的问题并知道解决方案。

最佳答案

  • sudo R CMD javareconf
  • install.packages("rJava",type='source')

  • rJava 包将解决这些错误。

    引用这些来自 thisthis .

    关于在 Mac 上安装 RWeka,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35230081/

    相关文章:

    r - 在 R 中拆分的快速替代方案

    macos - 一个好的 8086 模拟器

    r - 动态重新定义一个函数,比如 print.data.frame

    r - 未找到 devtools::test 对象

    java - HelloWorld : Eclipse on Mac 中的classes.jar 问题

    macos - Mac OS X POSIX 不兼容吗? (timer_settime)

    c++ - 如何解决 mac 中的 qt5(未找到软件包)cmake 错误?

    git - 设置 git 'core.editor' 时遇到问题

    r - 在 R 中找到矩阵的相邻元素

    r - 共现变量对的交叉制表