簡體   English   中英

安裝matplotlib,錯誤:安裝腳本退出並顯示錯誤:命令'gcc'失敗,退出狀態為1

[英]installing matplotlib, error: Setup script exited with error: command 'gcc' failed with exit status 1

我正在使用cygwin並使用easy_install來安裝matplotlib。 我得到上述錯誤。 到目前為止,我已經附加了安裝過程。 出了什么問題?

 $ easy_install matplotlib
Searching for matplotlib
Reading http://pypi.python.org/simple/matplotlib/
Reading http://matplotlib.org
Reading http://matplotlib.sourceforge.net
Reading http://sourceforge.net/project/showfiles.php?group_id=80706
Reading http://sourceforge.net/project/showfiles.php?group_id=80706&package_id=82474
Reading http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.1.0/
Reading http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.1.1/
Reading https://sourceforge.net/project/showfiles.php?group_id=80706&package_id=278194
Reading https://sourceforge.net/project/showfiles.php?group_id=80706&package_id=82474
Reading https://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-0.99.1/
Reading https://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-0.99.3/
Reading https://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.0
Reading https://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.0.1/
Best match: matplotlib 1.3.1
Downloading https://downloads.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.3.1/matplotlib-1.3.1.tar.gz
Processing matplotlib-1.3.1.tar.gz
Writing /tmp/easy_install-ocoQwv/matplotlib-1.3.1/setup.cfg
Running matplotlib-1.3.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-ocoQwv/matplotlib-1.3.1/egg-dist-tmp-P_dVeG
============================================================================
Edit setup.cfg to change the build options

BUILDING MATPLOTLIB
            matplotlib: yes [1.3.1]
                python: yes [2.7.5 (default, Oct  2 2013, 22:34:09)  [GCC
                        4.8.1]]
              platform: yes [cygwin]

REQUIRED DEPENDENCIES AND EXTENSIONS
                 numpy: yes [version 1.6.2]
              dateutil: yes [dateutil was not found. It is required for date
                        axis support. pip/easy_install may attempt to
                        install it after matplotlib.]
               tornado: yes [using tornado version 3.2]
             pyparsing: yes [using pyparsing version 2.0.1]
                 pycxx: yes [Couldn't import.  Using local copy.]
                libagg: yes [pkg-config information for 'libagg' could not
                        be found. Using local copy.]
              freetype: yes [version 16.1.10]
                   png: yes [version 1.5.14]

OPTIONAL SUBPACKAGES
           sample_data: yes [installing]
              toolkits: yes [installing]
                 tests: yes [using nose version 1.3.0]

OPTIONAL BACKEND EXTENSIONS
                macosx: no  [Mac OS-X only]
                qt4agg: yes [installing, Qt: 4.8.4, PyQt4: 4.10.2]
               gtk3agg: no  [Requires pygobject to be installed.]
             gtk3cairo: no  [Requires pygobject to be installed.]
                gtkagg: no  [The C/C++ header for pygtk (pygtk/pygtk.h)
                        could not be found.  You may need to install the
                        development package.]
                 tkagg: yes [installing, version 81008]
                 wxagg: no  [requires wxPython]
                   gtk: no  [The C/C++ header for pygtk (pygtk/pygtk.h)
                        could not be found.  You may need to install the
                        development package.]
                   agg: yes [installing]
                 cairo: yes [installing, version 1.10.0]
             windowing: no  [Microsoft Windows only]

OPTIONAL LATEX DEPENDENCIES
                dvipng: yes [version 1.14]
           ghostscript: yes [version 9.06]
                 latex: yes [version 3.1415926]
               pdftops: yes [version 0.22.5]

In file included from src/file_compat.h:4:0,
                 from src/_png.cpp:31:
/usr/lib/python2.7/site-packages/numpy/core/include/numpy/npy_3kcompat.h: In function ‘PyObject* npy_PyFile_OpenFile(PyObject*, char*)’:
/usr/lib/python2.7/site-packages/numpy/core/include/numpy/npy_3kcompat.h:258:60: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
     return PyObject_CallFunction(open, "Os", filename, mode);
                                                            ^
In file included from src/_png.cpp:31:0:
src/file_compat.h: In function ‘int npy_PyFile_CloseFile(PyObject*)’:
src/file_compat.h:125:50: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
     ret = PyObject_CallMethod(file, "close", NULL);
                                                  ^
src/_png.cpp: In function ‘void init_png()’:
src/_png.cpp:631:25: warning: variable ‘_png’ set but not used [-Wunused-but-set-variable]
     static _png_module* _png = NULL;
                         ^
In file included from src/file_compat.h:4:0,
                 from src/_png.cpp:31:
/usr/lib/python2.7/site-packages/numpy/core/include/numpy/npy_3kcompat.h: At global scope:
/usr/lib/python2.7/site-packages/numpy/core/include/numpy/npy_3kcompat.h:391:1: warning: ‘void simple_capsule_dtor(void*)’ defined but not used [-Wunused-function]
 simple_capsule_dtor(void *ptr)
 ^
src/_path.cpp: In function ‘void init_path()’:
src/_path.cpp:1759:26: warning: variable ‘_path’ set but not used [-Wunused-but-set-variable]
     static _path_module* _path = NULL;
                          ^
In file included from src/path_converters.h:10:0,
                 from src/path_cleanup.cpp:10:
agg24/include/agg_clip_liang_barsky.h: In function ‘void* get_path_iterator(PyObject*, PyObject*, int, int, double*, e_snap_mode, double, int, double, double, double)’:
agg24/include/agg_clip_liang_barsky.h:259:12: warning: ‘y1’ may be used uninitialized in this function [-Wmaybe-uninitialized]
            *x = (T)(double(bound - y1) * (x2 - x1) / (y2 - y1) + x1);
            ^
In file included from src/path_cleanup.cpp:10:0:
src/path_converters.h:440:28: note: ‘y1’ was declared here
         double x0, y0, x1, y1;
                            ^
In file included from src/path_converters.h:10:0,
                 from src/path_cleanup.cpp:10:
agg24/include/agg_clip_liang_barsky.h:62:39: warning: ‘x1’ may be used uninitialized in this function [-Wmaybe-uninitialized]
                ((y < clip_box.y1) << 3);
                                       ^
In file included from src/path_cleanup.cpp:10:0:
src/path_converters.h:440:24: note: ‘x1’ was declared here
         double x0, y0, x1, y1;
                        ^
In file included from src/path_converters.h:10:0,
                 from src/path_cleanup.cpp:10:
agg24/include/agg_clip_liang_barsky.h:259:12: warning: ‘y0’ may be used uninitialized in this function [-Wmaybe-uninitialized]
            *x = (T)(double(bound - y1) * (x2 - x1) / (y2 - y1) + x1);
            ^
In file included from src/path_cleanup.cpp:10:0:
src/path_converters.h:440:20: note: ‘y0’ was declared here
         double x0, y0, x1, y1;
                    ^
In file included from src/path_converters.h:10:0,
                 from src/path_cleanup.cpp:10:
agg24/include/agg_clip_liang_barsky.h:62:39: warning: ‘x0’ may be used uninitialized in this function [-Wmaybe-uninitialized]
                ((y < clip_box.y1) << 3);
                                       ^
In file included from src/path_cleanup.cpp:10:0:
src/path_converters.h:440:16: note: ‘x0’ was declared here
         double x0, y0, x1, y1;
                ^
In file included from /usr/include/python2.7/unicodeobject.h:57:0,
                 from /usr/include/python2.7/Python.h:85,
                 from ./CXX/WrapPython.h:58,
                 from ./CXX/Extensions.hxx:37,
                 from lib/matplotlib/tri/_tri.h:66,
                 from lib/matplotlib/tri/_tri.cpp:8:
lib/matplotlib/tri/_tri.h:821:33: error: expected unqualified-id before numeric constant
     const unsigned long _M, _A, _C;
                                 ^
lib/matplotlib/tri/_tri.cpp: In constructor ‘RandomNumberGenerator::RandomNumberGenerator(long unsigned int)’:
lib/matplotlib/tri/_tri.cpp:2180:28: error: expected identifier before numeric constant
     : _M(21870), _A(1291), _C(4621), _seed(seed % _M)
                            ^
lib/matplotlib/tri/_tri.cpp:2180:28: error: expected ‘{’ before numeric constant
lib/matplotlib/tri/_tri.cpp: At global scope:
lib/matplotlib/tri/_tri.cpp:2180:28: error: expected unqualified-id before numeric constant
error: Setup script exited with error: command 'gcc' failed with exit status 1

我建議你安裝PythonXY ,你將擁有幾乎所有你需要的東西,或者至少非常好的和眾所周知的libs(包括matplotlib,numpy,scipy等等)。 開箱即用 ,無需查找依賴項。

答案在這里https://github.com/matplotlib/matplotlib/issues/2463

“在第821行的lib / matplotlib / tri / _tri.h中定義了一個名為”_C“的變量,並在第2180和2186行的tri.cpp中調用。由於某些原因,gcc不喜歡這個(它是一個保留字)在某些架構中?)。我只是在tri.h和tri.cpp中將變量重命名為“_Co”,編譯成功完成。“

在Windows上,您可以為Python擴展包可執行文件安裝非官方Windows二進制文件,無需編譯它。

暫無
暫無

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

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