首页 > 解决方案 > 全新安装的 matplotlib 中缺少 cbook

问题描述

我通过 pip 安装了 ipython 和 matplot lib

当我尝试时import matplotlib.pyplot as plt,我收到此错误:

bash-4.2$ ipython
Python 3.6.3 (default, Jan  4 2018, 16:40:53) 
Type 'copyright', 'credits' or 'license' for more information
IPython 6.4.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import matplotlib.pyplot as plt
---------------------------------------------------------------------------
ImportError                               
Traceback (most recent call last)
<ipython-input-4-a0d2faabd9e9> in <module>()
----> 1 import matplotlib.pyplot as plt

~/.local/lib/python3.6/site-packages/matplotlib/__init__.py in <module>()
    125 # cbook must import matplotlib only within function
    126 # definitions, so it is safe to import from it here.
--> 127 from . import cbook
    128 from matplotlib.cbook import (
    129     _backports, mplDeprecation, dedent, get_label, sanitize_sequence)

ImportError: cannot import name 'cbook'

我怎样才能解决这个问题?

标签: pythonmatplotlibpython-3.6

解决方案


推荐阅读