我试图将rpy2导入到python中,我收到此错误:
RuntimeError: The R home directory could not be determined.
Try to install R <https://www.r-project.org/>,
set the R_HOME environment variable to the R home directory, or
add the directory of the R interpreter to the PATH environment variable.
Run Code Online (Sandbox Code Playgroud)
我完全迷失在这里,因为我不知道这告诉我什么.我试图搜索如何设置环境变量,但找不到任何对我有帮助的详细信息.如果答案可以非常简单,我会很感激,因为我只是一个新手.我正在运行OSX 10.11.
谢谢(我的第一篇文章,如果我忽略了发布中的任何规则,我道歉)
反之亦然-您的R PATH应该知道它的家:
edd@don:~$ R RHOME
/usr/lib/R
edd@don:~$
Run Code Online (Sandbox Code Playgroud)
这回声最后一行建议-必须在你的[R PATH。
在另一台同时具有R和R-devel的计算机上,我选择使用另一个名称来解决后者。尽管如此,每个人都知道HOME:
edd@max:~$ /usr/local/lib/R-devel/bin/R RHOME
/usr/local/lib/R-devel/lib/R
edd@max:~$ R RHOME
/usr/lib/R
edd@max:~$
Run Code Online (Sandbox Code Playgroud)
小智 6
以这种方式设置R_HOME对我有用
import os
os.environ['R_HOME'] = '/path/to/R'
Run Code Online (Sandbox Code Playgroud)