R安装时的问题
Posted 云飞
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了R安装时的问题相关的知识,希望对你有一定的参考价值。
R在安装 rJava 包是可能 安装不成功
问题1:
checking Java support in R... present: interpreter : ‘/usr/lib/jvm/jre/bin/java‘ archiver : ‘/usr/lib/jvm/jre/../bin/jar‘ compiler : ‘/usr/lib/jvm/jre/../bin/javac‘ header prep.: ‘/usr/lib/jvm/jre/../bin/javah‘ cpp flags : ‘-I/usr/lib/jvm/java/include I/usr/lib/jvm/java/include/linux‘ java libs : ‘-L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server -ljvm‘ checking whether Java run-time works... ./configure: line 3729: /usr/lib/jvm/jre/bin/java: No such file or directory no configure: error: Java interpreter ‘/usr/lib/jvm/jre/bin/java‘ does not work
原因在于 rJava默认会找系统JAVA_HOME 如果没有配置 JAVA_HOME 则会使用 /usr/lib/jvm/jre/bin/java 该目录可能在本机没有
解决办法是指定JAVA_HOME,之后重置R中环境变量
export JAVA_HOME=$PWD/env/java/jdk8 R CMD javareconf
问题2
checking Java support in R... present: interpreter : ‘/usr/bin/java‘ archiver : ‘/usr/bin/jar‘ compiler : ‘/usr/bin/javac‘ header prep.: ‘/usr/bin/javah‘ cpp flags : ‘-I/usr/lib/jvm/java-6-sun-1.6.0.20/jre/../include -I/usr/lib/jvm/java-6-sun-1.6.0.20/jre/../include/linux‘ java libs : ‘-L/usr/lib/jvm/java-6-sun-1.6.0.20/jre/lib/amd64/server -L/usr/lib/jvm/java-6-sun-1.6.0.20/jre/lib/amd64 -L/usr/lib/jvm/java-6-sun-1.6.0.20/jre/../lib/amd64 -L -L/usr/java/packages/lib/amd64 -L/usr/lib64 -L/lib64 -L/lib -L/usr/lib -ljvm‘ checking whether JNI programs can be compiled... yes checking JNI data types... configure: error: One or more JNI types differ from the corresponding native type. You may need to use non-standard compiler flags or a different compiler in order to fix this. ERROR: configuration failed for package ‘rJava’
该问题是没有配置 LD_LIBRARY_PATH 环境变量,解决办法和问题1 一样
export LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/amd64:$JAVA_HOME/jre/lib/amd64/server R CMD javareconf
所有该种问题可以一起设置
export JAVA_HOME=$PWD/env/java/jdk8 export LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/amd64:$JAVA_HOME/jre/lib/amd64/server R CMD javareconf
以上是关于R安装时的问题的主要内容,如果未能解决你的问题,请参考以下文章