import matplotlib ImportError: DLL load failed 问题及解决方法

在测试示例程序时,发现库导入错误。 这个问题,是由于 matplotlib库或者其依赖库(如numpy)安装不成功,不完成, 或者

matplotlib与其依赖的库(如numpy)的版本不兼容导致的。

解决办法

1.将使用的python环境下的matplotlib 移除(卸载)

 pip uninstall numpy

pip uninstall matplotlib

2.检查是否成功卸载

pip list

找不到numpy和matplotlib则写在成功

3.重新安装matplotlib。安装过程中,会自动安装其依赖的库,如numpy。

import matplotlib ImportError: DLL load failed 问题及解决方法