如何在emacs中指定ESS会话打开的R版本?(复制)

时间:2021-02-14 22:57:49

This question already has an answer here:

这个问题已经有了答案:

When I want to open an R session in emacs, I use M-x R.

当我想在emacs中打开一个R会话时,我使用M-x R。

However, our server has both R 2.12 in /usr/bin/R and R 2.15 in /usr/local/bin/R. Actually, if I ask whereis R, I get the following:

然而,我们的服务器在/usr/bin/R中都有r2.12,在/usr/local/bin/R中也有r2.15实际上,如果我问R是什么,我会得到以下结果:

$ whereis R
R: /usr/bin/R /usr/local/bin/R /usr/local/bin/R2.15 /usr/local/bin/R2.12 
/usr/local/bin/R2.7 /usr/include/R /usr/share/R /usr/share/man/man1/R.1.gz

When I try to export "R_HOME=/usr/local/bin/R2.15" from .bashrc, emacs says "WARNING: ignoring environment value of R_HOME"

当我尝试从.bashrc导出“R_HOME=/usr/local/bin/R2.15”时,emacs说“警告:忽略R_HOME的环境值”

Is there a way to choose which instance of R is launched? Currently, 2.15 is launched when I type R at the command line, even though M-x R launches 2.12.

是否有办法选择启动哪个R实例?目前,2.15是在我在命令行输入R时启动的,即使M-x R启动2.12。

1 个解决方案

#1


4  

The non-ESS answer is to make sure your PATH is identical, and the version you want comes first. There appears to be difference between the shell you launch, and the launch involving Emacs. You could launch Emacs from your shell with its PATH.

非ess的答案是确保您的路径是相同的,您想要的版本首先出现。您启动的shell和涉及Emacs的启动之间似乎存在差异。您可以从您的shell中以其路径启动Emacs。

The ESS answer probably involves setting some magic variable... On Windows we often set the binary directly. Here the lisp code says:

ESS的答案可能是设置一些神奇的变量……在Windows上,我们经常直接设置二进制。这里的lisp代码是:

;; If you wish to call other versions of R on a Unix system, ESS
;; should auto-detect other versions of R, according to matches to the
;; variable `ess-r-versions' as described in its docstring.  Consider
;; changing that variable rather than changing inferior-R-program-name
;; if your version of R is not already auto-detected.
;;(setq-default inferior-R-program-name "R")        ; unix systems

so it should just work. I keep only R in my PATH, and another out of it so I can't test this here for you. But try fiddling with ess-r-version and/or inferior-R-program-name.

所以它应该是有效的。我只在路径中保留R,还有一个因此我不能在这里测试。但是可以尝试修改一下ess-r版本和/或inferir -r程序名。

#1


4  

The non-ESS answer is to make sure your PATH is identical, and the version you want comes first. There appears to be difference between the shell you launch, and the launch involving Emacs. You could launch Emacs from your shell with its PATH.

非ess的答案是确保您的路径是相同的,您想要的版本首先出现。您启动的shell和涉及Emacs的启动之间似乎存在差异。您可以从您的shell中以其路径启动Emacs。

The ESS answer probably involves setting some magic variable... On Windows we often set the binary directly. Here the lisp code says:

ESS的答案可能是设置一些神奇的变量……在Windows上,我们经常直接设置二进制。这里的lisp代码是:

;; If you wish to call other versions of R on a Unix system, ESS
;; should auto-detect other versions of R, according to matches to the
;; variable `ess-r-versions' as described in its docstring.  Consider
;; changing that variable rather than changing inferior-R-program-name
;; if your version of R is not already auto-detected.
;;(setq-default inferior-R-program-name "R")        ; unix systems

so it should just work. I keep only R in my PATH, and another out of it so I can't test this here for you. But try fiddling with ess-r-version and/or inferior-R-program-name.

所以它应该是有效的。我只在路径中保留R,还有一个因此我不能在这里测试。但是可以尝试修改一下ess-r版本和/或inferir -r程序名。