Installing the R interpeter and R as a shared libr

2020-08-23 08:17发布

问题:

I am a bit confused about how to install R (via compilation) as a shared library.

The instructions here (Rpy2) say that I should do the following:

  # <go to the R source directory>
  make distclean
  ./configure --enable-R-shlib
  make
  make install

but the first make (make distclean) would remove any previous installation of R under the same directory tree (e.g. the contents of the bin folder).

What if I want to use the same installation for the R interpreter and the shared libraries? For example, say I want to use the interpreter to install R packages, and then the shared library of the installation to call R (and those packages) from Rpy2.

Otherwise, how can I install R packages for use through Rpy2?

回答1:

./configure --enable-R-shlib

Will tell to build R's shared libraries in addition to what is normally built (the executable, the documentation, etc...)

Also

make install

will install R (default is /usr/local). This is where you'll want to find your R executable. Calling make distclean will only affect the build directory, not the installed R.