【发布时间】:2017-04-13 08:49:54
【问题描述】:
我正在尝试在我的 MacBook Air、Yosemite 上安装 RPY2,并且我几乎按照以下website 中的说明进行操作。更具体地说,我:
- 已安装 R 3.3.2
- 按照 RPY2 网站的建议,使用
pip install rpy2安装了 Rpy2 - 使用
echo 'R_HOME="/Library/Frameworks/R.framework/Versions/3.3/Resources"; export R_HOME' >> ~/.bashrc将 R_HOME 变量设置为 R 主目录
但是,当我使用 from rpy2.rinterface import R_VERSION_BUILD 测试这是否适用于 Python
我得到错误:
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
from rpy2.rinterface import R_VERSION_BUILD
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/rpy2/rinterface/__init__.py", line 81, in <module>
""")
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.
我确实需要add the directory of the R interpreter to the PATH environment variable,如果需要,我该怎么做?
【问题讨论】:
标签: python r python-2.7 environment-variables rpy2