【问题标题】:python package installation gives "error: command 'gcc' failed with exit status 1"python包安装给出“错误:命令'gcc'失败,退出状态1”
【发布时间】:2015-03-10 10:18:57
【问题描述】:

我正在尝试使用 python2.7 在 Ubuntu 上安装一个名为 mlabwrap-1.1 的 python 包。但是,安装失败并报告:

error: command 'gcc' failed with exit status 1

注意:不久前我更新了 numpy 并收到了一堆警告,但我不知道这是否与它有关。

那么可能是什么问题?

一些细节

Linux 版本 3.2.0-49-generic (buildd@komainu) (gcc 版本 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #75-Ubuntu SMP Tue Jun 18 17:39:32 UTC 2013

我得到的确切错误:

[r@b ~/local/mlabwrap-1.1]$ sudo python setup.py install

running install
running build
running build_py
running build_ext
building 'mlabrawmodule' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -D_V6_5_OR_LATER=1 -I/usr/local/matlab/extern/include -I/usr/local/lib/python2.7/dist-packages/numpy-1.9.2-py2.7-linux-x86_64.egg/numpy/core/include -I/usr/include/python2.7 -c mlabraw.cpp -o build/temp.linux-x86_64-2.7/mlabraw.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for Ada/C/ObjC but not for C++ [enabled by default]
In file included from /usr/local/lib/python2.7/dist-packages/numpy-1.9.2-py2.7-linux-x86_64.egg/numpy/core/include/numpy/ndarraytypes.h:1804:0,
                 from /usr/local/lib/python2.7/dist-packages/numpy-1.9.2-py2.7-linux-x86_64.egg/numpy/core/include/numpy/ndarrayobject.h:17,
                 from /usr/local/lib/python2.7/dist-packages/numpy-1.9.2-py2.7-linux-x86_64.egg/numpy/core/include/numpy/arrayobject.h:4,
                 from mlabraw.cpp:136:
/usr/local/lib/python2.7/dist-packages/numpy-1.9.2-py2.7-linux-x86_64.egg/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
mlabraw.cpp: In function ‘PyArrayObject* mx2numeric(const mxArray*)’:
mlabraw.cpp:225:34: error: cannot convert ‘const mwSize* {aka const long unsigned int*}’ to ‘const int*’ in assignment
mlabraw.cpp: In function ‘mxArray* makeMxFromNumeric(const PyArrayObject*)’:
mlabraw.cpp:365:93: error: cannot convert ‘int*’ to ‘const mwSize* {aka const long unsigned int*}’ for argument ‘2’ to ‘mxArray* mxCreateNumericArray(mwSize, const mwSize*, mxClassID, mxComplexity)’
mlabraw.cpp: In function ‘mxArray* numeric2mx(PyObject*)’:
mlabraw.cpp:509:54: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
mlabraw.cpp: In function ‘PyObject* mlabraw_open(PyObject*, PyObject*)’:
mlabraw.cpp:570:16: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
mlabraw.cpp: In function ‘PyObject* mlabraw_eval(PyObject*, PyObject*)’:
mlabraw.cpp:631:15: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
mlabraw.cpp:662:66: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
mlabraw.cpp: In function ‘void initmlabraw()’:
mlabraw.cpp:895:65: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
error: command 'gcc' failed with exit status 1

【问题讨论】:

    标签: python gcc numpy installation


    【解决方案1】:

    我以前有过这个,需要安装 libevent-dev。

    apt-get install libevent-dev
    

    我现在无法检查,但我认为值得一试。

    【讨论】:

      【解决方案2】:

      您正在安装一个需要 C 扩展的 python 包,因此它至少需要一个像 gcc 这样的 C 编译器。现在在 numpy 的特定情况下,我建议使用打包的 apt-get install python-numpy,但如果由于某种原因你不想这样做,我会安装所有apt-get build-dep python-numpy 所需的软件包,然后重新运行安装。由于您看起来像 python 新手,我建议您开始使用 virtualenv 而不是全局安装库。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-11-01
        • 2014-07-06
        • 2011-11-11
        • 1970-01-01
        • 1970-01-01
        • 2018-09-30
        • 2012-06-21
        • 2019-12-01
        相关资源
        最近更新 更多