我在Ubuntu 14.04.2 LTS上遇到了rpy2。我有python版本2.7.6并运行
sudo pip install rpy2
似乎很成功。
Collecting rpy2
Using cached rpy2-2.6.1.tar.gz
Requirement already satisfied (use --upgrade to upgrade): six in /usr/local/lib/python2.7/dist-packages (from rpy2)
Requirement already satisfied (use --upgrade to upgrade): singledispatch in /usr/local/lib/python2.7/dist-packages/singledispatch-3.4.0.3-py2.7.egg (from rpy2)
Building wheels for collected packages: rpy2
Running setup.py bdist_wheel for rpy2
Stored in directory: /home/xxxxx/.cache/pip/wheels/7e/c7/b8/71c07d811319f897a43c9803d5cd890c66f4d18c3b6aa03e11
Successfully built rpy2
Installing collected packages: rpy2
Successfully installed rpy2-2.6.1
然而,当我尝试测试时
python -m rpy2.tests
结果没有前途:
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/local/lib/python2.7/dist-packages/rpy2/tests.py", line 23, in <module>
import rpy2.tests_rpy_classic
File "/usr/local/lib/python2.7/dist-packages/rpy2/tests_rpy_classic.py", line 3, in <module>
import rpy2.rpy_classic as rpy
File "/usr/local/lib/python2.7/dist-packages/rpy2/rpy_classic.py", line 5, in <module>
import rpy2.rinterface as ri
File "/usr/local/lib/python2.7/dist-packages/rpy2/rinterface/__init__.py", line 100, in <module>
from rpy2.rinterface._rinterface import *
ImportError: /usr/local/lib/python2.7/dist-packages/rpy2/rinterface/_rinterface.so: undefined symbol: Rf_allocVector3
我已经搜索了此错误但无法找到任何涉及Rf_allocVector3
的内容R I&#39; m的版本是3.0.2,如果有影响。
非常感谢任何帮助。
答案 0 :(得分:0)
对于rpy2-2.6.0来说R版本太旧了,我想。
文档让我们希望R-3.0.x没问题,但我认为事实并非如此:http://rpy.sourceforge.net/rpy2/doc-2.6/html/overview.html#requirements