问题
I am trying to use the magic command in ipython, something I saw here: rpy2 slides
I have done the following:
import rpy2.ipython
%load_ext rpy2.ipython
But I get the following error:
ImportError: dlopen(/Users/XXX/anaconda/lib/python2.7/site-packages/rpy2/rinterface/_rinterface.so,
2): Library not loaded: libicuuc.54.dylib Referenced from: /Users/XXX/anaconda/lib/python2.7/site-packages/rpy2/rinterface/_rinterface.so Reason: image not found
Some relevant information:
- OS: MacOS Sierra
- Python: 2.7.12
- iPython: IPython 5.1.0
- rpy2: 2.8.3
- Did the
pip install singledispatch
but the error still persists - r installed using conda
- Also have a copy of R from CRAN
回答1:
Because I installed R through conda, I also needed to install rpy2 through conda and not through pip. To install rpy2 through conda do the following,
conda install -c r rpy2
This worked really well. However, it is unclear why installing rpy2 through pip does not work.
来源:https://stackoverflow.com/questions/39756013/load-ext-rpy2-ipython-image-not-found-error