Python 2.7 在Mac OSX 10.8.5上安装rpy2

Python 2.7 在Mac OSX 10.8.5上安装rpy2,python-2.7,pip,osx-mountain-lion,rpy2,Python 2.7,Pip,Osx Mountain Lion,Rpy2,我正在尝试使用pip在Mac Mountain Lion(10.8.5)上安装rpy2: sudo pip install rpy2 并获取以下错误消息: clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future] clang: note: this will be a hard error (cannot be downgraded to a w

我正在尝试使用pip在Mac Mountain Lion(10.8.5)上安装rpy2:

sudo pip install rpy2
并获取以下错误消息:

clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
error: command 'clang' failed with exit status 1
sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install rpy2
clang: warning: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
clang: warning: argument unused during compilation: '-mno-fused-madd'
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 = rpy_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;
            ^
In file included from ./rpy/rinterface/_rinterface.c:129:
./rpy/rinterface/sequence.c:267:30: warning: implicit conversion loses integer precision: 'long' to 'R_len_t' (aka 'int') [-Wshorten-64-to-32]
    R_len_t slice_len = ihigh-ilow;
            ~~~~~~~~~   ~~~~~^~~~~
./rpy/rinterface/sequence.c:522:30: warning: implicit conversion loses integer precision: 'long' to 'R_len_t' (aka 'int') [-Wshorten-64-to-32]
    R_len_t slice_len = ihigh-ilow;
            ~~~~~~~~~   ~~~~~^~~~~
./rpy/rinterface/_rinterface.c:390:3: warning: variable 'consolecallback' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
  default:
  ^~~~~~~
./rpy/rinterface/_rinterface.c:416:7: note: uninitialized use occurs here
  if (consolecallback == NULL) {
      ^~~~~~~~~~~~~~~
./rpy/rinterface/_rinterface.c:382:24: note: initialize the variable 'consolecallback' to silence this warning
  void *consolecallback;
                       ^
                        = NULL
./rpy/rinterface/_rinterface.c:625:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
  int l=strlen(input_str);
      ~ ^~~~~~~~~~~~~~~~~
./rpy/rinterface/_rinterface.c:832:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
  int l=strlen(path_str);
      ~ ^~~~~~~~~~~~~~~~
./rpy/rinterface/_rinterface.c:1338:28: warning: implicit conversion loses integer precision: 'const Py_ssize_t' (aka 'const long') to 'int' [-Wshorten-64-to-32]
  status = Rf_initialize_R(n_args, options);
           ~~~~~~~~~~~~~~~ ^~~~~~
./rpy/rinterface/_rinterface.c:1730:13: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
  nparams = PySequence_Length(params);
          ~ ^~~~~~~~~~~~~~~~~~~~~~~~~
   /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/abstract.h:1065:27: note: expanded from macro 'PySequence_Length'
#define PySequence_Length PySequence_Size
                          ^
In file included from ./rpy/rinterface/_rinterface.c:129:
./rpy/rinterface/sequence.c:2174:1: warning: unused function 'ComplexVectorSexp_AsSexp' [-Wunused-function]
ComplexVectorSexp_AsSexp(PyObject *pyfloat) {
^
14 warnings generated.
clang -bundle -undefined dynamic_lookup -Wl,-F. -Wno-error=unused-command-line-argument-hard-error-in-future -Wno-error=unused-command-line-argument-hard-error-in-future -Wno-error=unused-command-line-argument-hard-error-in-future build/temp.macosx-10.8-x86_64-2.7/./rpy/rinterface/_rinterface.o -lpcre -llzma -licucore -lm -liconv -o build/lib.macosx-10.8-x86_64-2.7/rpy2/rinterface/_rinterface.so -F/Library/Frameworks/R.framework/.. -framework R
ld: library not found for -llzma
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
我的python版本是2.7.2,R版本是3.2.1

在一些帖子中,我读到我需要安装Xcode和命令行工具来解决这个问题,但我已经安装了这两个工具(Xcode 5.1.1)

(以下是在埃里克·阿佩尔特(Eric Appelt)的建议后添加的,我非常感谢他:)

我还尝试设置ARCHFLAGS以禁用错误消息:

clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
error: command 'clang' failed with exit status 1
sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install rpy2
clang: warning: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
clang: warning: argument unused during compilation: '-mno-fused-madd'
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 = rpy_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;
            ^
In file included from ./rpy/rinterface/_rinterface.c:129:
./rpy/rinterface/sequence.c:267:30: warning: implicit conversion loses integer precision: 'long' to 'R_len_t' (aka 'int') [-Wshorten-64-to-32]
    R_len_t slice_len = ihigh-ilow;
            ~~~~~~~~~   ~~~~~^~~~~
./rpy/rinterface/sequence.c:522:30: warning: implicit conversion loses integer precision: 'long' to 'R_len_t' (aka 'int') [-Wshorten-64-to-32]
    R_len_t slice_len = ihigh-ilow;
            ~~~~~~~~~   ~~~~~^~~~~
./rpy/rinterface/_rinterface.c:390:3: warning: variable 'consolecallback' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
  default:
  ^~~~~~~
./rpy/rinterface/_rinterface.c:416:7: note: uninitialized use occurs here
  if (consolecallback == NULL) {
      ^~~~~~~~~~~~~~~
./rpy/rinterface/_rinterface.c:382:24: note: initialize the variable 'consolecallback' to silence this warning
  void *consolecallback;
                       ^
                        = NULL
./rpy/rinterface/_rinterface.c:625:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
  int l=strlen(input_str);
      ~ ^~~~~~~~~~~~~~~~~
./rpy/rinterface/_rinterface.c:832:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
  int l=strlen(path_str);
      ~ ^~~~~~~~~~~~~~~~
./rpy/rinterface/_rinterface.c:1338:28: warning: implicit conversion loses integer precision: 'const Py_ssize_t' (aka 'const long') to 'int' [-Wshorten-64-to-32]
  status = Rf_initialize_R(n_args, options);
           ~~~~~~~~~~~~~~~ ^~~~~~
./rpy/rinterface/_rinterface.c:1730:13: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
  nparams = PySequence_Length(params);
          ~ ^~~~~~~~~~~~~~~~~~~~~~~~~
   /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/abstract.h:1065:27: note: expanded from macro 'PySequence_Length'
#define PySequence_Length PySequence_Size
                          ^
In file included from ./rpy/rinterface/_rinterface.c:129:
./rpy/rinterface/sequence.c:2174:1: warning: unused function 'ComplexVectorSexp_AsSexp' [-Wunused-function]
ComplexVectorSexp_AsSexp(PyObject *pyfloat) {
^
14 warnings generated.
clang -bundle -undefined dynamic_lookup -Wl,-F. -Wno-error=unused-command-line-argument-hard-error-in-future -Wno-error=unused-command-line-argument-hard-error-in-future -Wno-error=unused-command-line-argument-hard-error-in-future build/temp.macosx-10.8-x86_64-2.7/./rpy/rinterface/_rinterface.o -lpcre -llzma -licucore -lm -liconv -o build/lib.macosx-10.8-x86_64-2.7/rpy2/rinterface/_rinterface.so -F/Library/Frameworks/R.framework/.. -framework R
ld: library not found for -llzma
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
但现在我收到了以下错误消息:

clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
error: command 'clang' failed with exit status 1
sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install rpy2
clang: warning: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
clang: warning: argument unused during compilation: '-mno-fused-madd'
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 = rpy_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;
            ^
In file included from ./rpy/rinterface/_rinterface.c:129:
./rpy/rinterface/sequence.c:267:30: warning: implicit conversion loses integer precision: 'long' to 'R_len_t' (aka 'int') [-Wshorten-64-to-32]
    R_len_t slice_len = ihigh-ilow;
            ~~~~~~~~~   ~~~~~^~~~~
./rpy/rinterface/sequence.c:522:30: warning: implicit conversion loses integer precision: 'long' to 'R_len_t' (aka 'int') [-Wshorten-64-to-32]
    R_len_t slice_len = ihigh-ilow;
            ~~~~~~~~~   ~~~~~^~~~~
./rpy/rinterface/_rinterface.c:390:3: warning: variable 'consolecallback' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
  default:
  ^~~~~~~
./rpy/rinterface/_rinterface.c:416:7: note: uninitialized use occurs here
  if (consolecallback == NULL) {
      ^~~~~~~~~~~~~~~
./rpy/rinterface/_rinterface.c:382:24: note: initialize the variable 'consolecallback' to silence this warning
  void *consolecallback;
                       ^
                        = NULL
./rpy/rinterface/_rinterface.c:625:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
  int l=strlen(input_str);
      ~ ^~~~~~~~~~~~~~~~~
./rpy/rinterface/_rinterface.c:832:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
  int l=strlen(path_str);
      ~ ^~~~~~~~~~~~~~~~
./rpy/rinterface/_rinterface.c:1338:28: warning: implicit conversion loses integer precision: 'const Py_ssize_t' (aka 'const long') to 'int' [-Wshorten-64-to-32]
  status = Rf_initialize_R(n_args, options);
           ~~~~~~~~~~~~~~~ ^~~~~~
./rpy/rinterface/_rinterface.c:1730:13: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
  nparams = PySequence_Length(params);
          ~ ^~~~~~~~~~~~~~~~~~~~~~~~~
   /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/abstract.h:1065:27: note: expanded from macro 'PySequence_Length'
#define PySequence_Length PySequence_Size
                          ^
In file included from ./rpy/rinterface/_rinterface.c:129:
./rpy/rinterface/sequence.c:2174:1: warning: unused function 'ComplexVectorSexp_AsSexp' [-Wunused-function]
ComplexVectorSexp_AsSexp(PyObject *pyfloat) {
^
14 warnings generated.
clang -bundle -undefined dynamic_lookup -Wl,-F. -Wno-error=unused-command-line-argument-hard-error-in-future -Wno-error=unused-command-line-argument-hard-error-in-future -Wno-error=unused-command-line-argument-hard-error-in-future build/temp.macosx-10.8-x86_64-2.7/./rpy/rinterface/_rinterface.o -lpcre -llzma -licucore -lm -liconv -o build/lib.macosx-10.8-x86_64-2.7/rpy2/rinterface/_rinterface.so -F/Library/Frameworks/R.framework/.. -framework R
ld: library not found for -llzma
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1

任何帮助都将不胜感激

请尝试将
ARCHFLAGS=-Wno error=unused command line argument hard error in future sudo pip install rpy2
作为解决方法。抱歉-sudo应该放在第一位-
sudo ARCHFLAGS=-Wno error=unused command line argument hard error in future pip install rpy2
Hi Eric,非常感谢您的回答。不幸的是,它也不起作用。我得到了相同的错误,尽管前面有几个其他错误消息。为了方便起见,我在上面的主消息中添加了它们。你知道那里发生了什么吗?谢谢请尝试将
ARCHFLAGS=-Wno error=unused command line argument hard error in future sudo pip install rpy2
作为解决方法。抱歉-sudo应该放在第一位-
sudo ARCHFLAGS=-Wno error=unused command line argument hard error in future pip install rpy2
Hi Eric,非常感谢您的回答。不幸的是,它也不起作用。我得到了相同的错误,尽管前面有几个其他错误消息。为了方便起见,我在上面的主消息中添加了它们。你知道那里发生了什么吗?谢谢