gpt4 book ai didi

java - 在 R (Ubuntu 16.04) 中安装 RWeka 的问题

转载 作者:行者123 更新时间:2023-11-29 04:26:52 26 4
gpt4 key购买 nike

我想安装需要 RWeka 的 Fselector 包,但在安装 RWeka 时出现以下错误:

Error : .onLoad failed in loadNamespace() for 'RWeka', details:
call: .jcall("java/lang/System", "V", "setOut", out)
error: method setOut with signature (Ljava/io/PrintStream;)V not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/gaurav/R/x86_64-pc-linux-gnu-library/3.3/RWeka’
Warning in install.packages :
installation of package ‘RWeka’ had non-zero exit status
ERROR: dependency ‘RWeka’ is not available for package ‘FSelector’
* removing ‘/home/gaurav/R/x86_64-pc-linux-gnu-library/3.3/FSelector’
Warning in install.packages :
installation of package ‘FSelector’ had non-zero exit status

我搜索了大约相同的内容并用 jdk 做了一些修改,在 bashrc 中更新了 jdk/bin 的路径,但没有任何效果。

Session Info

R version 3.3.3 (2017-03-06)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.2 LTS

locale:
[1] LC_CTYPE=en_IN.UTF-8 LC_NUMERIC=C LC_TIME=en_IN.UTF-8
[4] LC_COLLATE=en_IN.UTF-8 LC_MONETARY=en_IN.UTF-8 LC_MESSAGES=en_IN.UTF-8
[7] LC_PAPER=en_IN.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_IN.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached):
[1] Rcpp_0.12.12 digest_0.6.12 mime_0.5 grid_3.3.3 plyr_1.8.4
[6] R6_2.2.2 xtable_1.8-2 gtable_0.2.0 scales_0.4.1 ggplot2_2.2.1
[11] rlang_0.1.1 lazyeval_0.2.0 brew_1.0-6 tools_3.3.3 munsell_0.4.3
[16] Rook_1.1-1 shiny_1.0.4 httpuv_1.3.5 colorspace_1.3-2 htmltools_0.3.6
[21] tibble_1.3.3

任何人都可以帮助我。

提前致谢

更新 1:@Nanov,我按照这些步骤操作,但仍然收到相同的错误,我有 openjdk 8 并更新了 bashrc 中的路径,当我使用“sudo R CMD javareconf”时,我得到以下信息:

gaurav@gaurav-ds:~$ sudo R CMD javareconf
Java interpreter : /usr/lib/jvm/java-8-oracle/jre/bin/java
Java version : 1.8.0_131
Java home path : /usr/lib/jvm/java-8-oracle/jre
Java compiler : not present
Java headers gen.:
Java archive tool:

trying to compile and link a JNI program
detected JNI cpp flags :
detected JNI linker flags : -L/usr/lib -ljvm
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time-D_FORTIFY_SOURCE=2 -g -c conftest.c -o conftest.oconftest.c:1:17: fatal error: jni.h: No such file or directory
#include <jni.h>
^
compilation terminated.
/usr/lib/R/etc/Makeconf:132: recipe for target 'conftest.o' failed
make: *** [conftest.o] Error 1
Unable to compile a JNI program.
JAVA_HOME : /usr/lib/jvm/java-8-oracle/jre
Java library path:
JNI cpp flags :
JNI linker flags :
Updating Java configuration in /usr/lib/R
Done.

最佳答案

 sudo apt-get install r-cran-rjava
sudo apt-get install openjdk-8-jdk
sudo rm -rf /usr/lib/jvm/default-java
sudo ln -s /usr/lib/jvm/java-8-openjdk-amd64/ /usr/lib/jvm/default-java
sudo R CMD javareconf

sudo R
install.packages(“RWeka”)

最好安装openjdk-8-jdk,因为在最新版本中-9-是bug。

关于java - 在 R (Ubuntu 16.04) 中安装 RWeka 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45839528/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com