python包安装提供"错误:命令' gcc'退出状态1"

时间:2015-03-10 10:18:57

标签: python gcc numpy installation

我试图在Ubuntu上使用python2.7安装一个名为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

2 个答案:

答案 0 :(得分:1)

之前我已经有了这个,需要安装libevent-dev。

apt-get install libevent-dev

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

答案 1 :(得分:0)

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

相关问题