我想在我的笔记本上使用 rpy2 库。但是整个早上我都在安装中失败了。
这里发布了一些问题。任何建议将不胜感激!
尝试 1
使用 pip install rpy2
。结果显示如下:
Complete output from command python setup.py egg_info:
Error: Tried to guess R's HOME but no command (R) in the PATH.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\hyf\appdata\local\temp\pip-build-gkdpb0\rpy2\
尝试2
接着,我阅读了一些帖子。有人说使用 .whl 格式的包可以解决问题。因此,我下载了这个包并尝试使用命令 pip install rpy2-2.7.8-cp27-none-win_amd64.whl
进行安装。结果失败了:
IOError: [Errno 13] Permission denied: 'D:\\Program\\Anaconda\\Lib\\site-packages\\rpy2\\rinterface\\_rinterface.pyd'
第三次尝试
可以使用conda install --channel https://conda.binstar.org/joshadel rpy2
来安装rpy2包。
但是,当我在ipython笔记本中这样调用它时:
import rpy2
from rpy2.robjects import r
结果显示错误:
RuntimeError: R_HOME not defined.
但是我已经将环境变量添加到系统变量中,就像这样:
R_HOME:D:\Program\R\bin\x64
R_User:D:\Program\Anaconda\Lib\site-packages\rpy2
我使用带有Python2.7内核和R 3.2.2的Anaconda。