由于错误,无法将matplotlib.pylab导入为plt
ImportError Traceback (most recent call last)
<ipython-input-3-41c182b8960f> in <module>
----> 1 import matplotlib.pylab as plt
~/anaconda3/envs/spiketutorial/lib/python3.6/site-packages/matplotlib/pylab.py in <module>
33 window_none)
34
---> 35 from matplotlib import cbook, mlab, pyplot as plt
36 from matplotlib.pyplot import *
37
~/anaconda3/envs/spiketutorial/lib/python3.6/site-packages/matplotlib/pyplot.py in <module>
2334 dict.__setitem__(rcParams, "backend", rcsetup._auto_backend_sentinel)
2335 # Set up the backend.
-> 2336 switch_backend(rcParams["backend"])
2337
2338 # Just to be safe. Interactive mode can be turned on without
~/anaconda3/envs/spiketutorial/lib/python3.6/site-packages/matplotlib/pyplot.py in switch_backend(newbackend)
285 "Cannot load backend {!r} which requires the {!r} interactive "
286 "framework, as {!r} is currently running".format(
--> 287 newbackend, required_framework, current_framework))
288
289 _log.debug("Loaded backend %s version %s.",
ImportError: Cannot load backend 'Qt5Agg' which requires the 'qt5' interactive framework, as 'headless' is currently running
我正在Windows 10上运行Ubuntu系统,并且在此环境中安装了pyqt5。此错误不仅是针对matplotlib的,而且当我尝试导入包含/需要qt5的任何其他软件包时也会出现此错误。我见过一些类似的问题,但似乎没有一个答案可以帮助我解决我的问题。一些答案表明Jupyter Notebook不支持GUI输出,我需要切换到本地编辑器。但是,我正在尝试的项目逐行进行,因此我更喜欢使用jupyter笔记本。有人对此问题有见识吗?
任何帮助将不胜感激!谢谢!