PyCharm提示 Backend Qt5Agg is interactive backend. Turning interactive mode on.(方法总结)

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

Backend Qt5Agg is interactive backend. Turning interactive mode on.

尝试了很多种方法,方法一解决了问题,推荐方法一。 

方法一:将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进行勾选,应用即可。此时最好重新打开窗口进行运算。

     参考:链接1链接2链接3

    来源:xiaozheng123121

    物联沃分享整理
    物联沃-IOTWORD物联网 » PyCharm提示 Backend Qt5Agg is interactive backend. Turning interactive mode on.(方法总结)

    发表评论