您的位置:首页 > 运维架构 > Linux

linux下python3.4配置matplotlib的问题

2016-04-13 17:23 621 查看
安装

在ubuntu下,直接apt-get install python3-matplotlib就安装了.


问题

但是我在执行

import matplotlib.pyplot as plt


会出现一个问题

The Gtk3Agg backend is known to not work on Python 3.x with pycairo


在stackoverflow查到了解决方案

先在python中执行

import matplotlib
matplotlib.matplotlib_fname()


结果就是matplotlib的配置文件matplotlibrc

编辑这个文件

把其中的backend : Gtk3Agg改成backend:TkAgg

当然这个前提 是你在机器上装过Tk的库

或者

把其中的backend : Gtk3Agg改成backend:qt5agg

这个也是要装点东西的..

sudo apt-get install python3-pyqt5


然后就可以完美运行
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  python ubuntu