应该是matplotlib版本问题,参考:https://blog.csdn.net/weixin_41194171/article/details/115750516
没有错误只是表面的,你需要编写的逻辑不发生错误!
逻辑问题,比如一个变量你先使用,后new。编译没错,但运行就会出错