when importing rpy2.robjects, I got the following error. It said I have to set the R_HOME environment variable or add the directory of the R interpreter to the PATH. But i do not know how to deal with it. How do you fix it? What should i do?
The problem appears only in idle, not in bash, sublime, pycharm or notebook!
PS: I have R(3.4) and rpy2(2.8.6), under mac, import rpy2 no error
PSS: I tried PATH="/Library/Frameworks/R.framework/Versions/3.4/Resources/bin:{PATH}” export PATH. but I failed.
>>> import rpy2.robjects as robjects
Traceback (most recent call last): File "", line 1, in import rpy2.robjects as robjects File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rpy2/robjects/init.py", line 16, in import rpy2.rinterface as rinterface File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rpy2/rinterface/init.py", line 81, in """) 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.