我从源代码安装了 matplotlib 1.1,但无法显示任何图表。
python setup.py build
显示以下内容:
BUILDING MATPLOTLIB
matplotlib: 1.1.0
python: 2.7.2+ (default, Oct 4 2011, 20:06:09) [GCC 4.6.1]
platform: linux2
REQUIRED DEPENDENCIES
numpy: 1.5.1
freetype2: 12.2.6
OPTIONAL BACKEND DEPENDENCIES
libpng: 1.2.46
Tkinter: no
* Using default library and include directories for
* Tcl and Tk because a Tk window failed to open.
* You may need to define DISPLAY for Tk to work so
* that setup can determine where your libraries are
* located. Tkinter present, but header files are not
* found. You may need to install development
* packages.
(setup.py:14683): Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap",
(setup.py:14683): Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap",
(setup.py:14683): Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap",
(setup.py:14683): Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap",
pkg-config: looking for pygtk-2.0 gtk+-2.0
* Package pygtk-2.0 was not found in the pkg-config
* search path. Perhaps you should add the directory
* containing `pygtk-2.0.pc' to the PKG_CONFIG_PATH
* environment variable No package 'pygtk-2.0' found
* You may need to install 'dev' package(s) to
* provide header files.
Gtk+: no
* Could not find Gtk+ headers in any of
* '/usr/local/include', '/usr/include', '.'
Mac OS X native: no
Qt: no
Qt4: no
Cairo: 1.8.8
OPTIONAL DATE/TIMEZONE DEPENDENCIES
datetime: present, version unknown
dateutil: 1.4.1
pytz: 2011c
OPTIONAL USETEX DEPENDENCIES
dvipng: no
ghostscript: 9.04
latex: no
pdftops: 0.16.7
但我想我已经有 tkinter 和 gtk 库了。有什么帮助吗?
答案1
为了详细说明 Oz123 的评论,apt-get build-dep foo
(或 aptitude)允许您提取构建所需的所有软件包富从存储库中获取。因此,要安装 matplotlib 所需的构建依赖项,请运行apt-get build-dep matplotlib