当我运行“sudo pip install rpy2”时,出现很多编译错误。
这是所有错误的完整转储 http://www.pastebin.ca/2878069这是一个例子,除了:
Compilation parameters for rpy2's C components:
include_dirs = ['/usr/share/R/include']
library_dirs = ['/usr/lib/R/lib']
libraries = ['R', 'pcre', 'lzma', 'bz2', 'z', 'rt', 'dl', 'm']
extra_link_args = ['-Wl,--export-dynamic', '-fopenmp']
R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet"
building 'rpy2.rinterface._rinterface' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DR_INTERFACE_PTRS=1 -DHAVE_POSIX_SIGJMP=1 -DRIF_HAS_RSIGHAND=1 -DCSTACK_DEFNS=1 -DHAS_READLINE=1 -I./rpy/rinterface -I/usr/share/R/include -I/usr/include/python2.7 -c ./rpy/rinterface/_rinterface.c -o build/temp.linux-x86_64-2.7/./rpy/rinterface/_rinterface.o
In file included from /usr/share/R/include/R.h:46:0,
from ./rpy/rinterface/_rinterface.h:8,
from ./rpy/rinterface/_rinterface.c:58:
/usr/share/R/include/R_ext/Memory.h:40:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
int R_gc_running();
^
In file included from ./rpy/rinterface/_rinterface.h:9:0,
from ./rpy/rinterface/_rinterface.c:58:
/usr/share/R/include/Rinternals.h:831:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
const char *R_curErrorBuf();
^
In file included from ./rpy/rinterface/_rinterface.c:70:0:
/usr/share/R/include/Rinterface.h:129:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
extern void (*ptr_R_ProcessEvents)();
^
In file included from ./rpy/rinterface/_rinterface.c:79:0:
/usr/share/R/include/R_ext/Rdynload.h:32:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
typedef void * (*DL_FUNC)();
^
./rpy/rinterface/_rinterface.c:86:31: fatal error: readline/readline.h: No such file or directory
#include <readline/readline.h>
^
compilation terminated.
一些背景。之前 ipython Notebook 开发版本的安装失败,并已恢复到 pip 存储库版本。不确定这是否起作用。在此之前能够让 R magic 发挥作用。
在尝试重新安装之前,我已确保运行“apt-get update”、“pip uninstall rpy2”、“apt-get purge python-rpy2 && apt-get remove python-rpy2”。为了检查是否有任何残留文件,我在 ipython 中运行了“import rpy2”,这导致了模块未找到错误(很好,没有任何残留)。
不确定从哪里开始排除故障。感谢您的建议。
编辑:2014 年 11 月 26 日
安装以下依赖项后它可以工作:
- apt-get 安装 libreadline-dev
- apt-get install r-base r-base-dev python-dev python-setuptools