Python 3.x Matplotlib.pyplot不是';行不通

Python 3.x Matplotlib.pyplot不是';行不通,python-3.x,ubuntu,matplotlib,Python 3.x,Ubuntu,Matplotlib,我在ubuntu上使用python3,我有一个问题: >>> import matplotlib.pyplot as plt /usr/local/lib/python3.4/dist-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment. warnings.warn('

我在ubuntu上使用python3,我有一个问题:

>>> import matplotlib.pyplot as plt
/usr/local/lib/python3.4/dist-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
  warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')
/usr/local/lib/python3.4/dist-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
  warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')
/usr/local/lib/python3.4/dist-packages/matplotlib/backends/backend_gtk3agg.py:18: UserWarning: The Gtk3Agg backend is known to not work on Python 3.x with pycairo. Try installing cairocffi.
  "The Gtk3Agg backend is known to not work on Python 3.x with pycairo. "

如何解决这个问题?

您可能希望研究Gtk3Agg后端的另一个替代方案是Tinker。举个例子:(在linux上使用Python 3.5.2(默认值,2016年11月17日,17:05:23)[GCC 5.4.0 20160609])

这将按预期生成绘图


默认情况下,通过在控制台(或
.bashrc
文件)中输入以下内容,可以使python使用此选项:
export-mplbindend=“TkAgg”

您是否确实读取了错误?它准确地告诉你该做什么。谷歌搜索这些警告将为您提供更多关于它们的信息。在问这个问题之前,至少试着自己解决这个问题。“众所周知,Gtk3Agg后端无法在pycairo的Python3.x上工作。请尝试安装cairocffi”。你试过了吗?
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
plt.plot(range(10))
plt.show()