ImportError: cannot import name cbook

Faster RCNN训练的时候,出现错误:

    from matplotlib import path, transforms
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/__init__.py", line 124, in <module>
    from . import cbook
ImportError: cannot import name cbook

同时python调用matplotlib也会出现以下错误:

  File "/usr/local/lib/python2.7/dist-packages/matplotlib/fontconfig_pattern.py", line 32, in <module>
    from backports.functools_lru_cache import lru_cache
ImportError: No module named functools_lru_cache

找了很久才找到解决办法,至于原因暂不清楚。

原来安装matplotlib用的命令是:

 sudo pip install matplotlib

这样就会有问题,不知道啥情况。卸掉matplotlib

sudo pip uninstall matplotlib

换成

sudo apt-get install python-matplotlib

就没以上两个问题了。

 

posted @ 2017-10-26 16:35  _云深不知处  阅读(9248)  评论(1编辑  收藏  举报