matplotlib在ubuntu 10.10上无法工作
我在使用Ubuntu 10.10的时候遇到了matplotlib的问题。
首先,我通过apt-get安装了matplotlib,结果发现版本是0.99,官网上的一些示例代码根本无法运行。于是我下载了1.01版本,并且在没有卸载0.99版本的情况下安装了它。为了让情况更清楚,这里是我的配置:
BUILDING MATPLOTLIB
matplotlib: 1.0.1
python: 2.6.6 (r266:84292, Sep 15 2010, 15:52:39) [GCC
4.4.5]
platform: linux2
REQUIRED DEPENDENCIES
numpy: 1.6.0b1
freetype2: 12.2.6
OPTIONAL BACKEND DEPENDENCIES
libpng: 1.2.44
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.
wxPython: no
* wxPython not found
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
* Package gtk+-2.0 was not found in the pkg-config
* search path. Perhaps you should add the directory
* containing `gtk+-2.0.pc' to the PKG_CONFIG_PATH
* environment variable No package 'gtk+-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: 2010b
OPTIONAL USETEX DEPENDENCIES
dvipng: no
ghostscript: 8.71
latex: no
pdftops: 0.14.3
[Edit setup.cfg to suppress the above messages]
现在我可以导入matplotlib了,但一运行示例代码,它就直接结束了,什么结果都没有。我尝试了好几次“干净安装”,也就是删除所有相关文件,包括.matplotlib文件夹和dist-package下的matplotlib目录,但还是没能解决问题。
更奇怪的是,当我重新安装0.99版本后,它却能正常工作。
有没有什么想法?
3 个回答
0
我在Ubuntu 12.04上也遇到了同样的问题。我通过安装python-gtk2-dev并重新安装matplotlib来解决了这个问题:
sudo apt-get install python-gtk2-dev
sudo pip install --upgrade matplotlib
关于依赖关系的提示信息变成了:
Gtk+: gtk+: 2.24.10, glib: 2.32.3, pygtk: 2.24.0, pygobject: 2.28.6
0
试着用 pip
来安装它:
sudo apt-get install python-pip
sudo pip install matplotlib
我刚刚测试过,这样做应该能安装 matplotlib 1.0.1 版本。
2
Ben Gamari 为 Ubuntu 系统打包了 matplotlib 1.0 这个工具。