我已经使用conda安装了R和rpy2
conda install -y rpy2=2.9.1 pyarrow=0.11.0 r-base=3.4.3 r-leaps=3.0
当我使用ipython解释器时,一切都很好:
import rpy2.robjects.packages as rpackages
leaps = rpackages.importr('leaps')
base = rpackages.importr('base')
但是,在预安装的jupyter笔记本克隆(Cloudera Datascicence Workbench)中,rpy2似乎默认为预安装的R安装,而不是conda环境中安装的R安装。至少当我尝试导入“ leaps”库时,出现错误:
RRuntimeError: Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/usr/local/lib/R/library/stats/libs/stats.so':
libRlapack.so: cannot open shared object file: No such file or directory
正确的库路径应位于的位置
~/.conda/envs/python3.6/lib/R/library/leaps/libs
谁能告诉我必须调整哪些环境变量以将rpy2指向正确的方向?