gpt4 book ai didi

linux - 无法安装 rJava

转载 作者:太空宇宙 更新时间:2023-11-04 04:37:04 29 4
gpt4 key购买 nike

无法在ubuntu中安装rjava包,R版本是3.1。安装jdk i.7。请分享R的java配置的确切路径。我已经尝试过javareconf -e来设置rjava的env。

以下是 rJava 安装后的输出。

    install.packages("rJava")  
Installing package into ‘/home/emraan/R/i686-pc-linux-gnu-library/3.1’

* installing *source* package ‘rJava’ ...
** package ‘rJava’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking whether time.h and sys/time.h may both be included... yes
configure: checking whether gcc -std=gnu99 supports static inline...
yes
checking whether setjmp.h is POSIX.1 compatible... yes
checking whether sigsetjmp is declared... yes
checking whether siglongjmp is declared... yes
checking Java support in R... present:
interpreter : '/usr/bin/java'
archiver : ''
compiler : '/usr/bin/javac'
header prep.: ''
cpp flags : '-I/usr/lib/jvm/jdk1.7.0_51/jre/../include'
java libs : '-L/usr/lib/jvm/jdk1.7.0_51/jre/lib/i386/client -ljvm'
configure: error: One or more Java configuration variables are not set.
Make sure R is configured with full Java support (including JDK). Run
R CMD javareconf
as root to add Java support to R.

If you don't have root privileges, run
R CMD javareconf -e
to set all Java-related variables and then install rJava.

ERROR: configuration failed for package ‘rJava’
* removing ‘/home/emraan/R/i686-pc-linux-gnu-library/3.1/rJava’
Warning in install.packages :
installation of package ‘rJava’ had non-zero exit status

The downloaded source packages are in
‘/tmp/Rtmp12bZIF/downloaded_packages’

**Output of sudo CMD R javareconf**

Java interpreter : /usr/lib/jvm/jdk1.7.0_51/jre/bin/java
Java version : 1.7.0_51
Java home path : /usr/lib/jvm/jdk1.7.0_51/jre
Java compiler : /usr/lib/jvm/jdk1.7.0_51/jre/../bin/javac
Java headers gen.: /usr/lib/jvm/jdk1.7.0_51/jre/../bin/javah
Java archive tool: /usr/lib/jvm/jdk1.7.0_51/jre/../bin/jar

trying to compile and link a JNI progam
detected JNI cpp flags : -I$(JAVA_HOME)/../include
detected JNI linker flags : -L$(JAVA_HOME)/lib/i386/client -ljvm
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/lib/jvm/jdk1.7.0_51/jre/../include -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c conftest.c -o conftest.o
gcc -std=gnu99 -shared -Wl,-Bsymbolic-functions -Wl,-z,relro -o conftest.so conftest.o -L/usr/lib/jvm/jdk1.7.0_51/jre/lib/i386/client -ljvm -L/usr/lib/R/lib -lR


JAVA_HOME : /usr/lib/jvm/jdk1.7.0_51/jre
Java library path: $(JAVA_HOME)/lib/i386/client
JNI cpp flags : -I$(JAVA_HOME)/../include
JNI linker flags : -L$(JAVA_HOME)/lib/i386/client -ljvm
Updating Java configuration in /usr/lib/R
/usr/lib/R/bin/javareconf: 405: /usr/lib/R/bin/javareconf: cannot create /usr/lib/R/etc/Makeconf.new: Permission denied
*** cannot create /usr/lib/R/etc/Makeconf.new
*** Please run as root if required.

最佳答案

我之前已经回答过这个问题 - 就这样做

 sudo apt-get install r-cran-rjava

因为这是发行版中维护的软件包。

如果失败,请告诉我,最好通过适当的(Debian)错误报告,因为我恰好是 R 包和这个 rJava 附加组件的维护者。

关于linux - 无法安装 rJava,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23171614/

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