gpt4 book ai didi

java - 错误 : unable to load installed packages just now

转载 作者:IT老高 更新时间:2023-10-28 20:44:30 24 4
gpt4 key购买 nike

当我尝试在 Eclipse 中运行 R 控制台时,我收到了这个错误:

....Please make sure that R package 'rj' (1.1 or compatible) is installed...

所以我尝试像这样在 R 控制台中安装它:

install.packages(c("rj", "rj.gd"), repos="http://download.walware.de/rj-1.1")

得到了这个错误:

 ** testing if installed package can be loaded
Error : .onLoad failed in loadNamespace() for 'rj.gd', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/home/alex/R/x86_64-pc-linux-gnu-library/2.15/rj.gd/libs/rj.gd.so':
libjvm.so: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed

我发现在安装 rJava 时使用:install.packages("rJava") 得到类似的错误:

** testing if installed package can be loaded
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/home/alex/R/x86_64-pc-linux-gnu-library/2.15/rJava/libs/rJava.so':
libjvm.so: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed

当我运行 sudo R CMD javareconf 时,我得到了这个输出:

Java interpreter : /usr/bin/java
Java version : 1.7.0
Java home path : /usr/lib/jvm/java-7-oracle/jre
Java compiler : /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar
NOTE: Your JVM has a bogus java.library.path system property!
Trying a heuristic via sun.boot.library.path to find jvm library...
Java library path: $(JAVA_HOME)/lib/amd64:$(JAVA_HOME)/lib/amd64/server
JNI linker flags : -L$(JAVA_HOME)/lib/amd64 -L$(JAVA_HOME)/lib/amd64/server -ljvm
JNI cpp flags : -I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/linux

Updating Java configuration in /etc/R
Done.

顺便说一下,我的配置是:

Ubuntu 11.10 64bit
Eclipse 3.7
Oracle-1.7-jdk
R version 2.15.1

最佳答案

对于 Linux(Ubuntu) 用户:如果您有 oracle-java (7/8)安装。它将在此位置 /usr/lib/jvm 并且需要 sudo 访问权限。

使用以下条目创建文件 /etc/ld.so.conf.d/java.conf:

/usr/lib/jvm/java-8-oracle/jre/lib/amd64
/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server

(根据您的 java 版本,将 java-8-oracle 替换为 java-7-oracle)

然后:

sudo ldconfig

重启 RStudio,然后安装 rJava 包。

另一种方法是导出 LD_LIBRARY_PATH 与从命令 R CMD javareconf -e 获得的 Java 库路径的值并运行 install.packages

关于java - 错误 : unable to load installed packages just now,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12872699/

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