簡體   English   中英

python軟件包安裝給出“錯誤:命令'gcc'失敗,退出狀態為1”

[英]python package installation gives “error: command 'gcc' failed with exit status 1”

我正在嘗試使用python2.7在Ubuntu上安裝一個名為mlabwrap-1.1的python軟件包。 但是,安裝失敗並報告:

error: command 'gcc' failed with exit status 1

注意:前一陣子我更新了numpy並收到了很多警告,但是我不知道這是否與此有關。

那么可能是什么問題呢?

一些細節

Linux版本3.2.0-49-通用(build @ 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

我以前有過這個,需要安裝libevent-dev。

apt-get install libevent-dev

我現在無法檢查,但是我認為值得嘗試。

您正在安裝需要C擴展名的python軟件包,因此它至少需要像gcc這樣的C編譯器。 現在在numpy的特定情況下,我建議使用打包的apt-get install python-numpy ,但是如果出於某些原因您不想這樣做,我將使用apt-get build安裝所有必需的軟件包-dep python-numpy ,然后重新運行安裝。 由於您看起來像python新手,因此建議您開始使用virtualenv而不是在全局安裝庫。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM