Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matplotlib 无法更改为其他GUI工具包:笔记本-Jupyter中的警告_Matplotlib_Jupyter Notebook_Backend - Fatal编程技术网

Matplotlib 无法更改为其他GUI工具包:笔记本-Jupyter中的警告

Matplotlib 无法更改为其他GUI工具包:笔记本-Jupyter中的警告,matplotlib,jupyter-notebook,backend,Matplotlib,Jupyter Notebook,Backend,我想在jupyter中使用交互式绘图,但在将后端切换到笔记本电脑时,我收到警告: 警告:无法更改为其他GUI工具包:笔记本。改用qt5 这种情况发生在Windows 10、Anaconda 1.8.7、jupyter 5.5.0、python 3.6.5和matplotlib 2.2.2上 最简单的工作示例: import matplotlib.pyplot as plt %matplotlib notebook 输出: Warning: Cannot change to a differen

我想在jupyter中使用交互式绘图,但在将后端切换到笔记本电脑时,我收到警告: 警告:无法更改为其他GUI工具包:笔记本。改用qt5

这种情况发生在Windows 10、Anaconda 1.8.7、jupyter 5.5.0、python 3.6.5和matplotlib 2.2.2上

最简单的工作示例:

import matplotlib.pyplot as plt
%matplotlib notebook
输出:

Warning: Cannot change to a different GUI toolkit: notebook. Using qt5 instead.
我在这里发现了问题的另一面,但还没有发现任何人有这个问题。 在某些情况下,我们提到导入ipympl是一种解决方案,但在我的情况下,这不会改变任何事情

有什么提示吗

正如评论中指出的,我的问题与jupyter启动时已经设置的后端有关。但是,如中所述,后端需要在
ipython\u config.py
中设置,而不是在
jupyter\u notebook\u config.py
中设置


重新启动笔记本服务器后,我可以按照说明在后端之间切换

必须将
%matplotlib小部件
放在Jupyterlab的最开头

反转命令顺序时是否会发生同样的情况?首先,
%matplotlib…
然后,
导入…
?是的。但我刚刚发现笔记本后端未在matplotlib.rcsetup.all_backends中注册:
matplotlib.rcsetup.all_backends:['GTK','GTKAgg','GTKCairo','GTK3Agg','GTK3Cairo','MacOSX','nbAgg','Qt4Agg','Qt4Cairo','Qt5Agg','Qt5Cairo','TkAgg','TkCairo','WebAgg','WX','WXAgg','WXCairo','agg','CAROR','gdk','pdf','pgf','ps','svg','template']
好吧,这里称之为
'nbAgg'
。但我认为这个列表甚至会列出后端,如果它们根本不可用的话。我没有您的确切版本(jupyter也由几个部分组成,不确定(5.5.0)指的是什么)但至少在我的设置中,我无法重现这个问题。因此,如果之前没有为我设置任何后端,问题就会重现。这意味着在配置中的某个位置,后端已设置为qt。在哪里可以找到此
ipython\u config.py
?它位于
~/.ipython/
中。但是如果运行jupyter从虚拟环境中,您可以搜索存储环境的路径