一般是版本不兼容的原因,解决思路为先卸载原有matplotlib再重新安装。参考如下: pip uninstall matplotlib pip install matplotlib 提供我这边可运行的版本信息: python : 2.7.14 matplotlib: 2.2.5