How to setup environment variable R_user to use rpy2 in python

前端 未结 6 1188
暗喜
暗喜 2020-11-28 08:43

I \'m unable to run rpy2 in python.

with this code

 import rpy2.robjects as robjects

Here\'s the full exceptions:


R

6条回答
  •  甜味超标
    2020-11-28 09:37

    For an instant and temporary solution, you can add the following code before importing rpy2:

    import os
    os.environ['R_HOME'] = 'C:/program files/R-3.3.1'
    

    One thing worth noting is that you should use backslash instead of slash in the path.

提交回复
热议问题