CentOS中python输入import matplotlib.pyplot提示有错误
2014-11-17 14:20
676 查看
在CentOS中安装matplotlib(使用命令yum install python-matplotlib)后,在试图导入pyplot后报错:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.6/site-packages/matplotlib/pyplot.py", line 78, in <module>
new_figure_manager, draw_if_interactive, show = pylab_setup()
File "/usr/lib64/python2.6/site-packages/matplotlib/backends/__init__.py", line 25, in pylab_setup
globals(),locals(),[backend_name])
File "/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_gtkagg.py", line 10, in <module>
from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\
File "/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_gtk.py", line 11, in <module>
raise ImportError("Gtk* backend requires pygtk to be installed.")
ImportError: Gtk* backend requires pygtk to be installed.
此时可以这样解决:
import matplotlib
matplotlib.use('Agg')
from matplotlib.pyplot import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.6/site-packages/matplotlib/pyplot.py", line 78, in <module>
new_figure_manager, draw_if_interactive, show = pylab_setup()
File "/usr/lib64/python2.6/site-packages/matplotlib/backends/__init__.py", line 25, in pylab_setup
globals(),locals(),[backend_name])
File "/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_gtkagg.py", line 10, in <module>
from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\
File "/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_gtk.py", line 11, in <module>
raise ImportError("Gtk* backend requires pygtk to be installed.")
ImportError: Gtk* backend requires pygtk to be installed.
此时可以这样解决:
import matplotlib
matplotlib.use('Agg')
from matplotlib.pyplot import *
相关文章推荐
- CentOS中python输入import matplotlib.pyplot提示有错误
- python import matplotlib.pyplot 提示找不到DLL
- ImportError: No module named matplotlib.pyplot安装模块python
- Python导入matplotlib错误提示ImportError: matplotlib requires pyparsing
- import matplotlib.pyplot 错误
- arch linux python3.6.2 import matplotlib.pyplot as plt 报错
- centos 安装python库matplotlib 错误
- ImportError: No module named matplotlib.pyplot安装模块python
- python 安装matplotlib后运行图表时提示错误numpy版本不对的解决方法
- CentOS 7 (Fedora EPEL 7) 下安装python3.4 matplotlib显示问题
- import matplotlib.pyplot as plt 出错
- 【python】matplotlib.pyplot入门
- python数据分析之(6)简单绘图matplotlib.pyplot
- ImportError: No module named matplotlib.pyplot
- python matplotlib 2D 散点图的制作(输入二维坐标)
- Linux下python matplotlib.pyplot在图像上显示中文的问题
- ImportError:No module named matplotlib.pyplot
- Mac下安装from matplotlib import pyplot或者 import matplotlib.pyplot as plt报错
- Python库 - import matplotlib.pyplot as plt 报错问题
- Python应用matplotlib.pyplot画图总结