pycharm中使用pyplot时报错MatplotlibDeprecationWarning

在pycharm中使用Matplotlib中的pyplot时,运行代码报错:

MatplotlibDeprecationWarning: Support for FigureCanvases without a required_interactive_framework attribute was deprecated in Matplotlib 3.6 and will be removed two minor releases later.

第一步,点击pycharm菜单栏File——setting选项;

第二步,在setting窗口中选择Tools——Python Scientific,然后取消勾选show plots in tool window后,点击apply按钮,再点击ok按钮。

第三步,在代码结尾加上 plt.show()后,代码就可以正常执行且不报错(注:这里的plt是我引用的别名,import matplotlib.pyplot as plt)

posted @ 2024-03-11 21:56  敲出未来,未来可期  阅读(858)  评论(0)    收藏  举报