0
我試圖在我的MacBook Air,Yosemite上安裝RPY2,而且我幾乎按照以下website的指示進行安裝。更具體地講,我:安裝RPy2 for MacOS:將R解釋器的目錄添加到PATH環境變量
- 安裝[R 3.3.2
- 使用
pip install rpy2
安裝Rpy2,由RPY2網站 - 設置R_HOME變量到R主目錄
echo 'R_HOME="/Library/Frameworks/R.framework/Versions/3.3/Resources"; export R_HOME' >> ~/.bashrc
但是,當我測試這是否適用於Python與
from rpy2.rinterface import R_VERSION_BUILD
我得到的錯誤:
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
,如果是這樣,我會怎麼做呢?
嗨@lgautier,謝謝你的建議。我會立即測試它。關於下載Python,我從www.python.org本身下載了它。那還行嗎? –
這很好,我認爲(Mac擁有者可以確認)。重要的部分是建議離開系統的Python。 – lgautier
我嘗試過三種方式(指向三種不同的R可執行文件),但仍然沒有運氣。即使重新啓動計算機後,我也會得到相同的錯誤。我檢查過重啓後設置了PATH。你有沒有其他建議? –