在我的Ubuntu 14.04服务器上尝试在虚拟环境中设置rpy2时,我遇到了很多不同的安装/构建错误,以至于我迷失了方向。这是我设置iPython服务器的最后一步,但我已经在rpy2安装上坚持了好几天了。我尝试过很多不同的事情,其中一些我肯定是相互冲突,使我的生活更困难(如双R版本安装),但我放弃尝试这样做没有外部帮助。
我做过很多事情:
已安装的python开发和设置工具
已安装和更新的pip
安装和更新gcc
从源代码生成并安装R的最新版本
使用Dirk Eddelbuetel's Docker file
[sudo]pip安装rpy2,具有稳定的R和开发R
从具有稳定R和开发R的源代码构建rpy2(具有--ignore-check-rversion选项集)
易于安装rpy2
pip install和source install,无论是否将RúHOME设置为stable R(当前默认R是不稳定的开发版本)
如果有人知道我能做什么来让这个工作,除了从零开始在一个干净的环境,那么请让我知道-这将是非常感谢。谢谢您!!
我得到的当前错误如下:

(.venv)zacp@contentvalue:~/rpy2-2.6.0$ python setup.py build_ext --ignore-check-rversion install
R Under development (unstable) (2015-06-16 r68524) -- "Unsuffered Consequences"
setup.py:196: UserWarning: R did not seem to have the minimum required version number
  warnings.warn("R did not seem to have the minimum required version number")
/usr/local/lib/R/bin/R CMD config --ldflags
R was not built as a library
/usr/local/lib/R/bin/R CMD config --cppflags
R was not built as a library
setup.py:211: UserWarning: No include specified
  warnings.warn('No include specified')
setup.py:222: UserWarning: No libraries as -l arguments to the compiler.
  warnings.warn('No libraries as -l arguments to the compiler.')

    Compilation parameters for rpy2's C components:
        include_dirs    = []
        library_dirs    = []
        libraries       = []
        extra_link_args = []

running build_ext
R Under development (unstable) (2015-06-16 r68524) -- "Unsuffered Consequences"
setup.py:77: UserWarning: R did not seem to have the minimum required version number
  warnings.warn("R did not seem to have the minimum required version number")
building 'rpy2.rinterface._rinterface' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -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/local/lib/python2.7.9/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/local/lib/python2.7.9/include/python2.7/Python.h:8:0,
                 from ./rpy/rinterface/_rinterface.c:55:
/usr/local/lib/python2.7.9/include/python2.7/pyconfig.h:1182:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
 #define _POSIX_C_SOURCE 200112L
 ^
In file included from /usr/include/signal.h:28:0,
                 from ./rpy/rinterface/_rinterface.c:51:
/usr/include/features.h:230:0: note: this is the location of the previous definition
 # define _POSIX_C_SOURCE 200809L
 ^
In file included from ./rpy/rinterface/_rinterface.c:58:0:
./rpy/rinterface/_rinterface.h:8:15: fatal error: R.h: No such file or directory
 #include <R.h>
               ^
compilation terminated.
error: command 'gcc' failed with exit status 1

最佳答案

我想我用apt-get安装的R版本已经过时了。根据documentation,R 3.0“可能没问题”,我想我误解了警告。
哎呀!

关于python - 无法终生安装rpy2-GCC错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31117588/

10-12 17:22
查看更多