-->

rpy2 installation on Ubuntu

2019-05-05 12:10发布

问题:

I'm pretty new to Linux and I'm having some serious trouble installing Rpy2. I had an older versions of Rpy2 installed by the synaptic package manager, but I needed an updated version and removed it (all files in the Rpy2 directory as described in the Rpy2 documentation). I downloaded the tar.gz. from SourceForge and ran this code:

tar -xzf rpy2-2.1.8.tar.gz
cd rpy2-2.1.8
python setup.py build install

It appeared to be copying files as it should, but then multiple pages of error messages (highlighted in bold) just start floating:

running build_ext
Configuration for R as a library:
include_dirs: ('/usr/share/R/include',)
libraries: ('lapack', 'blas', 'R')
library_dirs: ('/usr/lib/R/lib',)
extra_link_args: ()
# OSX-specific (included in extra_link_args)
framework_dirs: ()
frameworks: ()
building 'rpy2.rinterface.rinterface' extension
creating build/temp.linux-i686-2.6
creating build/temp.linux-i686-2.6/rpy
creating build/temp.linux-i686-2.6/rpy/rinterface
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes    
-fPIC -DR_INTERFACE_PTRS=1 -DHAVE_POSIX_S  
IGJMP=1 -DCSTACK_DEFNS=1 -DRIF_HAS_RSIGHAND=1 -Irpy/rinterface -I/usr/include/python2.6 -I/usr/share/R/include -c rpy/rinterface/rinterface.c -o build/temp.linux-i686-2.6/rpy/rinterface/rinterface.o

**rpy/rinterface/rinterface.c:55:20: error: Python.h: No such file or directory**
In file included from rpy/rinterface/rinterface.c:74:
/usr/share/R/include/R_ext/Rdynload.h:26: warning: function declaration isn’t a prototype

I hope you can help me.

Thanks, Lasse

回答1:

It looks like you do not have python-dev package on your system.