以前我们了解了windows系统R软件的安装与包的安装,今天我们来学习一下R软件如何在linux系统下安装。
linux 安装 R(没有root权限)
wget http://ftp.ctex.org/mirrors/CRAN/src/base/R-2/R-3.0.2.tar.gz .tar -zxvf R-3.0.2.tar.gz
cd ./R-3.0.2
./configure --prefix=/your_path/R-3.0.2 --enable-R-shlib
make
make install
vi ~/.bash_profile
添加R_HOME和R_LIBS变量,并修改PATH.
哪能总这么一帆风顺,总会有风雨是吧!
来,看一下经常出现的错误信息及解决方案:
-
提示错误信息为“configure: error: No F77 compiler found”,执行命令yum install gcc-gfortran解决。
-
再次执行./configure,报错:“configure: error: —with-readline=yes (default) and headers/libs are not available”,
-
执行命令./configure —with-readline=no,继续报错:“configure: error: –with-x=yes (default) and X11 headers/libs are not available”。
-
尝试执行命令./configure —with-readline=no —with-x=no通过,只是会提示警告信息:
configure: WARNING: you cannot build DVI versions of the R manuals
configure: WARNING: you cannot build DVI versions of all the help pages
configure: WARNING: you cannot build info or HTML versions of the R manuals
configure: WARNING: you cannot build PDF versions of the R manuals
configure: WARNING: you cannot build PDF versions of all the help pages
-
make
-
make install
-
安装成功。进入R命令行界面,可以操作。但tab自动补全以及上下左右等方向键都无法使用。应该是./configure —with-readline=no —with-x=no惹的祸。因此重新安装了一下,这次在执行./configure命令前先执行了命令:
-
yum install readline-devel(解决错误“ —with-readline=yes (default) and headers/libs are not available”)
-
yum install libXt-devel(解决错误“–with-x=yes (default) and X11 headers/libs are not available”)
-
最终安装成功,并且tab自动补全等都有效。
Linux升级R软件(升级自己以前安装的R,同样没有root权限)
-
旧版R的library文件夹复制到某个目录下