首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >python包安装出现"error:命令'gcc‘失败,退出状态1“

python包安装出现"error:命令'gcc‘失败,退出状态1“
EN

Stack Overflow用户
提问于 2015-03-10 18:18:57
回答 2查看 1.6K关注 0票数 0

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

代码语言:javascript
复制
error: command 'gcc' failed with exit status 1

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

那么,问题可能是什么呢?

一些细节

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

我得到的确切错误是:

代码语言:javascript
复制
[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
EN

回答 2

Stack Overflow用户

发布于 2015-03-10 18:29:03

我以前遇到过这种情况,需要安装libevent-dev。

代码语言:javascript
复制
apt-get install libevent-dev

我现在没有办法检查这个,但我认为值得一试。

票数 1
EN

Stack Overflow用户

发布于 2015-03-10 18:27:48

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28961082

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档