windows下安装rpy2

1、R环境变量设置
Path中添加
D:\Program Files\R\R-3.5.3\bin\x64;D:\Program Files\R\R-3.5.3\bin\x64\R.dll

2、进http://www.lfd.uci.edu/~gohlke/pythonlibs/#rpy2 下载相应的版本,并安装

3、在py代码中测试

import os
os.environ['R_HOME'] = 'D:\Program Files\R\R-3.5.3'
os.environ['R_USER'] = 'D:\Program Files\Python\Python37\Lib\site-packages\rpy2'
import rpy2.robjects as robjects

你可能感兴趣的:(R,python)