rPython安装失败,libpython不在链接器路径中

Joh*_*nck 4 r linker-errors rpython

在构建rPython包时,我在R中遇到错误,特别是链接libpython2.7的部分:

gcc -std=gnu99 -I/foo/bar/R-3.1.1/lib64/R/include -DNDEBUG  -I/usr/local/include \
  -I/foo/bar/Python-2.7.6/include/python2.7 -I/foo/bar/Python-2.7.6/include/python2.7 \
  -D PYTHONLIBFILE=libpython2.7.so -fpic  -g -O2  -c pycall.c -o pycall.o

gcc -std=gnu99 -shared -L/usr/local/lib64 -o rPython.so pycall.o \
  -lpthread -ldl -lutil -lm -lpython2.7 -Xlinker -export-dynamic

/usr/bin/ld: error: cannot find -lpython2.7
Run Code Online (Sandbox Code Playgroud)

问题似乎是,当R(或rPython)理解使用我的Python安装编译哪个-I规则时,它没有添加相应的链接器标志.我不知道为什么,假设这是一个错误.

Wal*_*mer 6

我也有同样的问题,我可以通过安装python-dev包解决它,我在一些论坛上看到它说实话.

您可以使用以下命令从终端安装:

sudo apt-get install python-dev
Run Code Online (Sandbox Code Playgroud)

然后重新尝试再次安装rPython.

它对我有用!