Python Process finished with exit code 2 解决方案

在使用python中matplotlib.pyplot库画图的时候出现了下图的错误

Python Process finished with exit code 2 解决方案

 百度了很久,没有找到答案

尝试看了一下库的版本

Python Process finished with exit code 2 解决方案

Python Process finished with exit code 2 解决方案

尝试更新一下

指令是pip install --upgrade matplotlib

Python Process finished with exit code 2 解决方案

这张图是我更新之后又运行了一遍指令显示的,可以看出来已经更新到最高版本了。

回PyCharm运行一下

Python Process finished with exit code 2 解决方案

成功了

看看图

Python Process finished with exit code 2 解决方案

效果不错