如何在/ etc / profile中设置R环境?

时间:2022-09-12 23:25:09

my os is debian6,there is a libR.pc after i compile to install R

我的os是debian6,编译安装R后有一个libR.pc

root@debian:/home/tiger# cat /home/tiger/R-2.15.1/lib/pkgconfig/libR.pc  
rhome=/home/tiger/R-2.15.1/lib/R  
rlibdir=${rhome}/lib  
rincludedir=/home/tiger/R-2.15.1/lib/R/include  
Name: libR  
Description: R as a library  
Version: 2.15.1  
Libs: -L${rlibdir} -lR  
Cflags: -I${rincludedir} -I${rincludedir}  
Libs.private:  

when set R environment in /etc/profile:
R_HOME= /home/tiger/R-2.15.1
or
R_HOME= /home/tiger/R-2.15.1/lib/R
which line will i choose to write in /etc/profile?

在/ etc / profile中设置R环境时:R_HOME = /home/tiger/R-2.15.1或R_HOME = /home/tiger/R-2.15.1/lib/R我将选择在/ etc /中写入哪一行个人资料?

2 个解决方案

#1


1  

On a Debian (or derivative such as Ubuntu system) you have /etc/R/ to set variable which R uses:

在Debian(或Ubuntu系统等衍生产品)上你有/ etc / R /来设置R使用的变量:

edd@max:~$ ls -l /etc/R/
total 28
-rw-r--r-- 1 root root  602 Jun 17 20:29 ldpaths
-rw-r--r-- 1 root root 5461 Jun 17 20:29 Makeconf
-rw-r--r-- 1 root root 1868 Mar 31 13:50 Renviron
-rw-r--r-- 1 root root  608 Sep 25  2009 Renviron.site
-rw-r--r-- 1 root root 1159 Mar 31 08:03 repositories
-rw-r--r-- 1 root root  792 Oct 28  2009 Rprofile.site
edd@max:~$ 

and the files in R_HOME/etc/ should be softlinks --- at least if you use the prebuilt binaries. If you build you own binaries, it's your problem.

并且R_HOME / etc /中的文件应该是softlinks ---至少如果你使用预建的二进制文件。如果你构建自己的二进制文件,那就是你的问题。

The file you quote is installed as /usr/lib/pkgconfig/libR.pc on a Debian / Ubuntu system. Setting R_HOME is not needed as R finds its own values (see @flodel's answer).

您引用的文件在Debian / Ubuntu系统上安装为/usr/lib/pkgconfig/libR.pc。 R不需要设置R_HOME,因为R找到自己的值(参见@ flodel的答案)。

#2


0  

On my system:

在我的系统上:

cat $R_HOME

gives nothing, but inside an R session, I get:

什么都没有,但在R会话中,我得到:

> Sys.getenv("R_HOME")
[1] "/usr/lib/R"

This should tell you two things:

这应该告诉你两件事:

  1. that R_HOME is set at R's startup, so unless you know exactly what you are doing, maybe you don't need to set it up in your /etc/profile.
  2. R_HOME设置为R的启动,所以除非你确切知道自己在做什么,否则你可能不需要在/ etc / profile中进行设置。

  3. you can use Sys.getenv to find out the exact path to your R_HOME.
  4. 您可以使用Sys.getenv找到R_HOME的确切路径。

#1


1  

On a Debian (or derivative such as Ubuntu system) you have /etc/R/ to set variable which R uses:

在Debian(或Ubuntu系统等衍生产品)上你有/ etc / R /来设置R使用的变量:

edd@max:~$ ls -l /etc/R/
total 28
-rw-r--r-- 1 root root  602 Jun 17 20:29 ldpaths
-rw-r--r-- 1 root root 5461 Jun 17 20:29 Makeconf
-rw-r--r-- 1 root root 1868 Mar 31 13:50 Renviron
-rw-r--r-- 1 root root  608 Sep 25  2009 Renviron.site
-rw-r--r-- 1 root root 1159 Mar 31 08:03 repositories
-rw-r--r-- 1 root root  792 Oct 28  2009 Rprofile.site
edd@max:~$ 

and the files in R_HOME/etc/ should be softlinks --- at least if you use the prebuilt binaries. If you build you own binaries, it's your problem.

并且R_HOME / etc /中的文件应该是softlinks ---至少如果你使用预建的二进制文件。如果你构建自己的二进制文件,那就是你的问题。

The file you quote is installed as /usr/lib/pkgconfig/libR.pc on a Debian / Ubuntu system. Setting R_HOME is not needed as R finds its own values (see @flodel's answer).

您引用的文件在Debian / Ubuntu系统上安装为/usr/lib/pkgconfig/libR.pc。 R不需要设置R_HOME,因为R找到自己的值(参见@ flodel的答案)。

#2


0  

On my system:

在我的系统上:

cat $R_HOME

gives nothing, but inside an R session, I get:

什么都没有,但在R会话中,我得到:

> Sys.getenv("R_HOME")
[1] "/usr/lib/R"

This should tell you two things:

这应该告诉你两件事:

  1. that R_HOME is set at R's startup, so unless you know exactly what you are doing, maybe you don't need to set it up in your /etc/profile.
  2. R_HOME设置为R的启动,所以除非你确切知道自己在做什么,否则你可能不需要在/ etc / profile中进行设置。

  3. you can use Sys.getenv to find out the exact path to your R_HOME.
  4. 您可以使用Sys.getenv找到R_HOME的确切路径。