【问题标题】:Install matplotlib in CentOS using yum在 CentOS 中使用 yum 安装 matplotlib
【发布时间】:2014-07-09 08:38:14
【问题描述】:

我希望在 CentOS 上安装 matplotlib,使用:

yum 安装 python-matplotlib.x86_64

它可以工作,但问题是它是旧版本(matplotlib 0.99.1.1),我需要最后一个版本:[1.3.1]。

所以我已经下载了源代码并尝试使用:python setup.py install 但是我得到了这个错误......


Edit setup.cfg to change the build options

BUILDING MATPLOTLIB
            matplotlib: yes [1.3.1]
                python: yes [2.6.6 (r266:84292, Jan 22 2014, 09:42:36)  [GCC
                        4.4.7 20120313 (Red Hat 4.4.7-4)]]
              platform: yes [linux2]

REQUIRED DEPENDENCIES AND EXTENSIONS
                 numpy: yes [version 1.8.1]
              dateutil: yes [using dateutil version 1.4.1]
               tornado: yes [using tornado version 3.2.2]
             pyparsing: yes [using pyparsing version 2.0.2]
                 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 9.22.3]
                   png: yes [version 1.2.49]

OPTIONAL SUBPACKAGES
           sample_data: yes [installing]
              toolkits: yes [installing]
                 tests: yes [nose 0.11.1 or later is required to run the
                        matplotlib test suite]

OPTIONAL BACKEND EXTENSIONS
                macosx: no  [Mac OS-X only]
                qt4agg: no  [PyQt4 not found]
               gtk3agg: no  [Requires pygobject to be installed.]
             gtk3cairo: no  [Requires pygobject to be installed.]
Xlib:  extension "RANDR" missing on display "localhost:22.0".
                gtkagg: no  [The C/C++ header for gtk (gtk/gtk.h) could not
                        be found.  You may need to install the development
                        package.]
                 tkagg: yes [installing, version 73770]
                 wxagg: no  [requires wxPython]
                   gtk: no  [The C/C++ header for gtk (gtk/gtk.h) could not
                        be found.  You may need to install the development
                        package.]
                   agg: yes [installing]
                 cairo: yes [installing, version 1.8.6]
             windowing: no  [Microsoft Windows only]

OPTIONAL LATEX DEPENDENCIES
                dvipng: yes [version 1.11]
           ghostscript: yes [version 8.70]
                 latex: yes [version 3.141592]
               pdftops: no

running install
running bdist_egg
running egg_info
writing requirements to lib/matplotlib.egg-info/requires.txt
writing lib/matplotlib.egg-info/PKG-INFO
writing namespace_packages to lib/matplotlib.egg-info/namespace_packages.txt
writing top-level names to lib/matplotlib.egg-info/top_level.txt
writing dependency_links to lib/matplotlib.egg-info/dependency_links.txt
reading manifest file 'lib/matplotlib.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'lib/matplotlib.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
copying lib/matplotlib/mpl-data/matplotlibrc -> build/lib.linux-x86_64-2.6/matplotlib/mpl-data
running build_ext
building 'matplotlib._png' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib__png_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -I/usr/lib64/python2.6/site-packages/numpy/core/include -I/usr/local/include -I/usr/include -I. -I/usr/include/libpng12 -I/usr/include/python2.6 -c src/_png.cpp -o build/temp.linux-x86_64-2.6/src/_png.o
In file included from /usr/lib64/python2.6/site-packages/numpy/core/include/numpy/ndarraytypes.h:1798,
                 from /usr/lib64/python2.6/site-packages/numpy/core/include/numpy/ndarrayobject.h:17,
                 from /usr/lib64/python2.6/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from src/_png.cpp:28:
/usr/lib64/python2.6/site-packages/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"
src/_png.cpp:243:48: error: macro "npy_PyFile_DupClose" requires 3 arguments, but only 2 given
src/_png.cpp:264:44: error: macro "npy_PyFile_DupClose" requires 3 arguments, but only 2 given
src/_png.cpp:577:44: error: macro "npy_PyFile_DupClose" requires 3 arguments, but only 2 given
In file included from src/file_compat.h:4,
                 from src/_png.cpp:31:
/usr/lib64/python2.6/site-packages/numpy/core/include/numpy/npy_3kcompat.h: In function ‘PyObject* npy_PyFile_OpenFile(PyObject*, const char*)’:
/usr/lib64/python2.6/site-packages/numpy/core/include/numpy/npy_3kcompat.h:348: warning: deprecated conversion from string constant to ‘char*’
/usr/lib64/python2.6/site-packages/numpy/core/include/numpy/npy_3kcompat.h: In function ‘int npy_PyFile_CloseFile(PyObject*)’:
/usr/lib64/python2.6/site-packages/numpy/core/include/numpy/npy_3kcompat.h:356: warning: deprecated conversion from string constant to ‘char*’
src/_png.cpp: In member function ‘Py::Object _png_module::write_png(const Py::Tuple&)’:
src/_png.cpp:243: error: ‘npy_PyFile_DupClose’ was not declared in this scope
src/_png.cpp:264: error: ‘npy_PyFile_DupClose’ was not declared in this scope
src/_png.cpp: In member function ‘PyObject* _png_module::_read_png(const Py::Object&, bool, int)’:
src/_png.cpp:329: warning: deprecated conversion from string constant to ‘char*’
src/_png.cpp:577: error: ‘npy_PyFile_DupClose’ was not declared in this scope
error: command 'gcc' failed with exit status 1

有什么帮助吗? 谢谢

【问题讨论】:

  • 它期望 Numpy 提供某个未提供的功能。检查安装的 Numpy 版本是否与 matplotlib 所需的版本匹配。还要检查您是否有 numpy 的开发人员文件,因为设置可能会链接到这些文件。

标签: gcc matplotlib centos


【解决方案1】:

此问题已在 1.4.0 版中得到修复(请参阅补丁 here)。在修补 setupext.py 以降低所需的 freetype 版本(如安装说明中的建议)后,我已在 CentOS 6.5 上成功编译了 1.4.0 版本。

【讨论】:

猜你喜欢
  • 2011-03-31
  • 2014-09-14
  • 2021-06-03
  • 2012-07-26
  • 2012-11-10
  • 2011-01-08
  • 2017-01-11
  • 2020-05-19
  • 2017-12-19
相关资源
最近更新 更多