我正在尝试使用pip:
在Mac Mountain Lion(10.8.5)上安装rpy2sudo 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
我的python版本是2.7.2,R版本是3.2.1。
在一些帖子中,我读过我需要安装Xcode和命令行工具来解决问题,但我已经安装了(Xcode 5.1.1)。
(以下是在Eric Appelt的建议之后添加的,我非常感谢他们:)
我还尝试设置ARCHFLAGS以禁用错误消息:
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
非常感谢任何帮助!