目录

方法一:将matplotlib的backend设置为非交互式。[推荐]

方法二:pip install opencv-python。

方法三:勾选 Gevent compatible


PyCharm 运行程序时突然出现下面错误

Backend Qt5Agg is interactive backend. Turning interactive mode on.

主要有 3 种方法,推荐方法一。 

方法一:将matplotlib的backend设置为非交互式。[推荐]

  • 找到 matplotlibrc 文件,并用记事本打开,路径如下:

D:\Anaconda3\envs\[your environment]\Lib\site-packages\matplotlib\mpl-data\matplotlibrc

比如我的是:

D:\Anaconda\pkgs\matplotlib-base-3.3.2-py38hba9282a_0\Lib\site-packages\matplotlib\mpl-data\matplotlibrc

  •  将 #backend:Agg  修改为去掉注释 ——backend:Agg 

 修改后的样子如下:

## You can also deploy your own backend outside of matplotlib by
## referring to the module name (which must be in the PYTHONPATH) as
## 'module://my_backend'.
#backend      : Agg
backend      : Agg

方法二:pip install opencv-python。

方法三:勾选 Gevent compatible

在pycharm窗口下,选择 File --> Settings --> Build, Execution, Deployment --> Python Debugger, 将Gevent compatible进行勾选,应用即可。此时最好重新打开窗口进行运算。

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐