PyCharm 运行程序时突然出现下面错误
Backend Qt5Agg is interactive backend. Turning interactive mode on.
尝试了很多种方法,方法一解决了问题,推荐方法一。
方法一:将matplotlib的backend设置为非交互式。- 找到 matplotlibrc 文件,并用记事本打开;
D:Anaconda3envs[your environment]Libsite-packagesmatplotlibmpl-datamatplotlibrc
比如我的是:
D:Anacondapkgsmatplotlib-base-3.3.2-py38hba9282a_0Libsite-packagesmatplotlibmpl-datamatplotlibrc
- 将 #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进行勾选,应用即可。此时最好重新打开窗口进行运算。
参考:链接1、链接2、链接3



