在python3.5osx上安装rpy2时出现问题

2024-03-28 10:47:17 发布

您现在位置:Python中文网/ 问答频道 /正文

因此,我已经为一些不同的计算机安装了rpy2,在尝试在python3.5上安装rpy2(rpy2-2.7.8)之前,我没有遇到安装rpy2的问题。我有一台mac电脑,由于某些原因,它一直未能构建rpy2 wheel,我不明白我收到的以下错误:

R version 3.2.4 (2016-03-10) -- "Very Secure Dishes"
building 'rpy2.rinterface._rinterface' extension
gcc -fno-strict-aliasing -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/JayDuck/anaconda/include -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -DR_INTERFACE_PTRS=1 -DHAVE_POSIX_SIGJMP=1 -DRIF_HAS_RSIGHAND=1 -DCSTACK_DEFNS=1 -DHAS_READLINE=1 -I./rpy/rinterface -I/Library/Frameworks/R.framework/Resources/include -I/Users/JayDuck/anaconda/include/python3.5m -c ./rpy/rinterface/_rinterface.c -o build/temp.macosx-10.5-x86_64-3.5/./rpy/rinterface/_rinterface.o
In file included from ./rpy/rinterface/_rinterface.c:104:
./rpy/rinterface/embeddedr.h:6:27: warning: duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
extern const unsigned int const RPY_R_INITIALIZED;
                          ^
./rpy/rinterface/embeddedr.h:7:27: warning: duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
extern const unsigned int const RPY_R_BUSY;
                          ^
In file included from ./rpy/rinterface/_rinterface.c:122:
./rpy/rinterface/embeddedr.c:5:20: warning: duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
const unsigned int const RPY_R_INITIALIZED = 0x01;
                   ^
./rpy/rinterface/embeddedr.c:6:20: warning: duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
const unsigned int const RPY_R_BUSY = 0x02;
                   ^
./rpy/rinterface/embeddedr.c:48:12: warning: unused variable 'res' [-Wunused-variable]
      SEXP res = rpy2_remove(Rf_mkString(name_buf),
           ^
In file included from ./rpy/rinterface/_rinterface.c:125:
./rpy/rinterface/sexp.c:738:13: warning: unused variable 'copy' [-Wunused-variable]
  PyObject *copy = Py_True;
            ^
./rpy/rinterface/_rinterface.c:353:3: warning: variable 'consolecallback' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
  default:
  ^~~~~~~
./rpy/rinterface/_rinterface.c:379:7: note: uninitialized use occurs here
  if (consolecallback == NULL) {
      ^~~~~~~~~~~~~~~
./rpy/rinterface/_rinterface.c:345:24: note: initialize the variable 'consolecallback' to silence this warning
  void *consolecallback;
                       ^
                        = NULL
In file included from ./rpy/rinterface/_rinterface.c:58:
./rpy/rinterface/_rinterface.h:203:44: warning: unused function 'PyRinterface_IsInitialized' [-Wunused-function]
  static PyRinterface_IsInitialized_RETURN PyRinterface_IsInitialized PyRinterface_IsInitialized_PROTO;
                                           ^
./rpy/rinterface/_rinterface.h:204:38: warning: unused function 'PyRinterface_FindFun' [-Wunused-function]
  static PyRinterface_FindFun_RETURN PyRinterface_FindFun PyRinterface_FindFun_PROTO;
                                     ^
In file included from ./rpy/rinterface/_rinterface.c:128:
./rpy/rinterface/sequence.c:2168:1: warning: unused function 'ComplexVectorSexp_AsSexp' [-Wunused-function]
ComplexVectorSexp_AsSexp(PyObject *pyfloat) {
^

10 warnings generated.
gcc -bundle -undefined dynamic_lookup -L/Users/JayDuck/anaconda/lib -isysroot /Developer/SDKs/MacOSX10.5.sdk -arch x86_64 build/temp.macosx-10.5-x86_64-3.5/./rpy/rinterface/_rinterface.o -L/Users/JayDuck/anaconda/lib -Lbuild/temp.macosx-10.5-x86_64-3.5 -lpcre -llzma -lbz2 -lz -licucore -lm -liconv -lr_utils -o build/lib.macosx-10.5-x86_64-3.5/rpy2/rinterface/_rinterface.cpython-35m-darwin.so -F/Library/Frameworks/R.framework/.. -framework R
ld: library not found for -lpcre
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'gcc' failed with exit status 1

----------------------------------------
Command "/Users/JayDuck/anaconda/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/3r/n1wqjn9j5wz0z6brfp3k73sm0000gr/T/pip-build-a34prbaf/rpy2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/3r/n1wqjn9j5wz0z6brfp3k73sm0000gr/T/pip-d4_f6wpt-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/3r/n1wqjn9j5wz0z6brfp3k73sm0000gr/T/pip-build-a34prbaf/rpy2/

我已经将最新版本的R(3.2.4)、Xcode和所有常用的包安装到python上,因此在使用“pip install”时,我不完全理解安装过程中的问题是什么。如果有人能告诉我如何解决这个问题并正确安装rpy2接口,那就太好了。谢谢!!在


Tags: buildfunctionanacondavariableusersx86filewarning