如何防止 PyCharm 覆盖 matplotlib 中设置的默认后端? [英] How to prevent PyCharm from overriding default backend as set in matplotlib?

查看:69
本文介绍了如何防止 PyCharm 覆盖 matplotlib 中设置的默认后端?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 .config/matplotlib/matplotlibrc 中将默认后端设置为 Qt5Agg.如果我使用常规 ssh 提示并打开 ipython 并运行 import matplotlib as mpl

I've set my default backend to Qt5Agg in .config/matplotlib/matplotlibrc. This works if I use a regular ssh prompt and open ipython and run import matplotlib as mpl

我正确地得到:mpl.get_backend() =>Qt5Agg"

当我通过 pyCharm 远程控制台连接时,默认后端设置为 'module://backend_interagg',这似乎是 pycharm 专门构建的辅助扩展.

When I connect through pyCharm remote console, the default backend is set to 'module://backend_interagg' which seems to be a purpose built helper extension by pycharm.

使用 mpl.use("Qt5Agg") 按预期工作(即正确设置后端并允许我使用它).

Using mpl.use("Qt5Agg") works as expected (i.e. correctly sets the backend and allows me to use it).

我只是想让默认工作和 pycharm 远程控制台正确使用我的 rc 文件参数.

I'm just trying to get the default working and the pycharm remote console to properly use my rc file parameters.

Fwiw,我已经尝试将我的主 rc 文件(在 site-packages 目录中)设置为具有 Qt5Agg,但我仍然遇到这个问题.

Fwiw, I've tried actually setting my master rc file (in the site-packages directory) to have Qt5Agg and I still get this problem.

此外,mpl.get_configdir() 正确返回 ~/.config/matplotlib

有什么想法吗?

推荐答案

我在 PyCharm 2017.3.3 中遇到了同样的问题,帮助禁用了 Show plots in toolwindow 中的复选框文件 ->设置 ->工具 ->Python 科学.

I had the same problem in PyCharm 2017.3.3 and what helped was to disable the checkbox Show plots in toolwindow in File -> Settings -> Tools -> Python Scientific.

这篇关于如何防止 PyCharm 覆盖 matplotlib 中设置的默认后端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆