rpy2 import is not working

后端 未结 8 1152
逝去的感伤
逝去的感伤 2021-02-14 16:16

I get an error when I try to import rpy2. Here is the code and error.

>>> import pandas.rpy.common
Traceback (most recent call last):  

File \"C:\\PF\         


        
8条回答
  •  梦谈多话
    2021-02-14 16:22

    That looks like a pandas interface to rpy2. Separately, you also need rpy2 installed on your system. I don't have rpy2, so it was easy for me to check this:

    In [1]: import pandas.rpy.common
    (...)
    ImportError: No module named rpy2.robjects.packages
    
    
    In [2]: import rpy2
    (...)
    ImportError: No module named rpy2
    

    I installed it using pip:

    $ pip install rpy2
    
    In [1]: import pandas.rpy.common
    

    It works! It import rpy2 works for you, but import pandas.rpy.common does not then the problem might be more subtle.

提交回复
热议问题