安装matplotlib,错误:安装脚本退出并显示错误:命令'gcc'失败,退出状态为1

时间:2014-01-22 13:56:38

标签: python matplotlib cygwin

我正在使用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

3 个答案:

答案 0 :(得分:1)

我建议你安装PythonXY,你将拥有几乎所有你需要的东西,或者至少非常好的和众所周知的libs(包括matplotlib,numpy,scipy等等)。它开箱即用 ,无需查找依赖项。

答案 1 :(得分:1)

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

“在第821行的lib / matplotlib / tri / _tri.h中定义了一个名为”_C“的变量,并在2180和2186行的tri.cpp中调用。由于某种原因,gcc不喜欢这个(是它某些架构中的保留字?)。我只是在tri.h和tri.cpp中将变量重命名为“_Co”,编译成功完成。“

答案 2 :(得分:0)

在Windows上,您可以安装Unofficial Windows Binaries for Python Extension Packages个可执行文件,无需编译。

相关问题