安装 Enthought Canopy python 后,我重新安装了 R 和 rpy2。
在 python 中,我现在可以:
import rpy2
没有错误信息。但是,当我想导入任何特定的 rpy2 模块时,我收到以下错误:
import rpy2.robjects
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-2-bd461266c9bc> in <module>()
----> 1 import rpy2.robjects
/Users/martinkampmann/Library/Enthought/Canopy_32bit/User/lib/python2.7/site-packages/rpy2-2.3.5-py2.7-macosx-10.6-i386.egg/rpy2/robjects/__init__.py in <module>()
13 import itertools
14 from datetime import datetime
---> 15 import rpy2.rinterface as rinterface
16 import rpy2.rlike.container as rlc
17
/Users/martinkampmann/Library/Enthought/Canopy_32bit/User/lib/python2.7/site-packages/rpy2-2.3.5-py2.7-macosx-10.6-i386.egg/rpy2/rinterface/__init__.py in <module>()
99
100
--> 101 from rpy2.rinterface._rinterface import *
102
103
ImportError: dlopen(/Users/martinkampmann/Library/Enthought/Canopy_32bit/User/lib/python2.7/site-packages/rpy2-2.3.5-py2.7-macosx-10.6-i386.egg/rpy2/rinterface/_rinterface.so, 2): Symbol not found: _R_BaseEnv
Referenced from: /Users/martinkampmann/Library/Enthought/Canopy_32bit/User/lib/python2.7/site-packages/rpy2-2.3.5-py2.7-macosx-10.6-i386.egg/rpy2/rinterface/_rinterface.so
Expected in: flat namespace
in /Users/martinkampmann/Library/Enthought/Canopy_32bit/User/lib/python2.7/site-packages/rpy2-2.3.5-py2.7-macosx-10.6-i386.egg/rpy2/rinterface/_rinterface.so