我在使用matplotlib在ubuntu 10.10中工作时遇到了问题。
首先我使用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版本后,它的效果非常好。
有什么想法吗?
答案 0 :(得分:2)
Ben Gamari为Ubuntu提供了packaged matplotlib 1.0。
答案 1 :(得分:0)
尝试使用pip
:
sudo apt-get install python-pip
sudo pip install matplotlib
我刚试过这个,它应该安装matplotlib 1.0.1。
答案 2 :(得分: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