如何解决阻止使用 setup.py 安装包的 gcc 错误?

如何解决阻止使用 setup.py 安装包的 gcc 错误?

我正在尝试安装包循环标记对于 Python(在 Macos 上),但我收到“错误:命令‘gcc’失败,退出状态为 1”。我已经仔细检查了 setup.py 文件的所有参数,即 MATLAB_COMMAND、MATLAB_VERSION、MATLAB_DIR 和 PLATFORM_DIR。我也有最新的 Xcode(并且 gcc 可从命令行使用)。有人知道如何解决这个问题吗?

以下是尝试使用以下命令安装包时的完整输出python setup.py install

running install
running build
running build_py
running build_ext
building 'mlabrawmodule' extension
gcc -fno-strict-aliasing -I/Users/mactobe/anaconda/envs/SIPLCA27/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -D_V6_5_OR_LATER=1 -D_V7_3_OR_LATER=1 -I/Applications/MATLAB_R2018a.app/extern/include -I/Users/mactobe/anaconda/envs/SIPLCA27/lib/python2.7/site-packages/numpy/core/include -I/Users/mactobe/anaconda/envs/SIPLCA27/include/python2.7 -c mlabraw.cpp -o build/temp.macosx-10.6-x86_64-2.7/mlabraw.o
In file included from mlabraw.cpp:136:
In file included from /Users/mactobe/anaconda/envs/SIPLCA27/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4:
In file included from /Users/mactobe/anaconda/envs/SIPLCA27/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12:
In file included from /Users/mactobe/anaconda/envs/SIPLCA27/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1822:
/Users/mactobe/anaconda/envs/SIPLCA27/lib/python2.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: 
      "Using deprecated NumPy API, disable it with "          "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it with " \
 ^
mlabraw.cpp:246:11: error: use of undeclared identifier 'mxGetPiIsDeprecated'
    lPI = mxGetPi(pArray);
          ^
/Applications/MATLAB_R2018a.app/extern/include/matrix.h:608:17: note: expanded from macro 'mxGetPi'
#define mxGetPi mxGetPiIsDeprecated
                ^
mlabraw.cpp:369:8: error: use of undeclared identifier 'mxGetPiIsDeprecated'
  lI = mxGetPi(lRetval);
       ^
/Applications/MATLAB_R2018a.app/extern/include/matrix.h:608:17: note: expanded from macro 'mxGetPi'
#define mxGetPi mxGetPiIsDeprecated
                ^
mlabraw.cpp:373:10: warning: 'NPY_CHAR' is deprecated: Use NPY_STRING [-Wdeprecated-declarations]
    case PyArray_CHAR:
         ^
/Users/mactobe/anaconda/envs/SIPLCA27/lib/python2.7/site-packages/numpy/core/include/numpy/old_defines.h:49:29: note: expanded
      from macro 'PyArray_CHAR'
#define PyArray_CHAR        NPY_CHAR
                            ^
/Users/mactobe/anaconda/envs/SIPLCA27/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:84:30: note: 
      'NPY_CHAR' has been explicitly marked deprecated here
                    NPY_CHAR NPY_ATTR_DEPRECATE("Use NPY_STRING"),
                             ^
/Users/mactobe/anaconda/envs/SIPLCA27/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:25:50: note: expanded
      from macro 'NPY_ATTR_DEPRECATE'
#define NPY_ATTR_DEPRECATE(text) __attribute__ ((deprecated (text)))
                                                 ^
mlabraw.cpp:418:10: warning: 'NPY_CHAR' is deprecated: Use NPY_STRING [-Wdeprecated-declarations]
    case PyArray_CHAR:
         ^
/Users/mactobe/anaconda/envs/SIPLCA27/lib/python2.7/site-packages/numpy/core/include/numpy/old_defines.h:49:29: note: expanded
      from macro 'PyArray_CHAR'
#define PyArray_CHAR        NPY_CHAR
                            ^
/Users/mactobe/anaconda/envs/SIPLCA27/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:84:30: note: 
      'NPY_CHAR' has been explicitly marked deprecated here
                    NPY_CHAR NPY_ATTR_DEPRECATE("Use NPY_STRING"),
                             ^
/Users/mactobe/anaconda/envs/SIPLCA27/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:25:50: note: expanded
      from macro 'NPY_ATTR_DEPRECATE'
#define NPY_ATTR_DEPRECATE(text) __attribute__ ((deprecated (text)))
                                                 ^
mlabraw.cpp:509:37: warning: conversion from string literal to 'char *' is deprecated
      [-Wc++11-compat-deprecated-writable-strings]
    arp = PyObject_CallMethod(pSrc, "__array__", NULL);
                                    ^
mlabraw.cpp:570:16: warning: conversion from string literal to 'char *' is deprecated
      [-Wc++11-compat-deprecated-writable-strings]
  char *lStr = "\0"; // "matlab -check_malloc";
               ^
mlabraw.cpp:631:15: warning: conversion from string literal to 'char *' is deprecated
      [-Wc++11-compat-deprecated-writable-strings]
  char* fmt = "try, %s; MLABRAW_ERROR_=0; catch, MLABRAW_ERROR_=1; end;";
              ^
mlabraw.cpp:662:50: warning: conversion from string literal to 'char *' is deprecated
      [-Wc++11-compat-deprecated-writable-strings]
    if (NULL == (lArray = _getMatlabVar(lHandle, "MLABRAW_ERROR_")) ) {
                                                 ^
mlabraw.cpp:895:38: warning: conversion from string literal to 'char *' is deprecated
      [-Wc++11-compat-deprecated-writable-strings]
  mlabraw_error = PyErr_NewException("mlabraw.error", NULL, NULL);
                                     ^
8 warnings and 2 errors generated.
error: command 'gcc' failed with exit status 1

相关内容