@邹博,python 中 import matplotlib.pyplot 会报Keyerror 'qt5' 的错

我直接装了一个anaconda3,用的是里面的python3,然后运行{{{import matplotlib.pyplot as plt}}}会有以下错误:
Traceback (most recent call last):
  File "E:\PyCharm 4.5.1\helpers\pydev\pydev_ipython\inputhook.py", line 502, in enable_gui
    gui_hook = guis
KeyError: 'qt5'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\PyCharm 4.5.1\helpers\pydev\pydev_ipython_console_011.py", line 120, in enable_gui
    return real_enable_gui(gui, app)
  File "E:\PyCharm 4.5.1\helpers\pydev\pydev_ipython\inputhook.py", line 508, in enable_gui
    raise ValueError(e)
ValueError: Invalid GUI request 'qt5', valid ones are:dict_keys()

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2885, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "", line 1, in
    import matplotlib.pyplot as plt
  File "E:\PyCharm 4.5.1\helpers\pydev\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "E:\Anaconda3\lib\site-packages\matplotlib\pyplot.py", line 2535, in
    install_repl_displayhook()
  File "E:\Anaconda3\lib\site-packages\matplotlib\pyplot.py", line 166, in install_repl_displayhook
    ip.enable_gui(ipython_gui_name)
  File "E:\PyCharm 4.5.1\helpers\pydev\pydev_ipython_console_011.py", line 122, in enable_gui
    raise UsageError("%s" % e)
IPython.core.error.UsageError: Invalid GUI request 'qt5', valid ones are:dict_keys()
 
 在网上查了一圈都没搞定,老师能帮忙解决下吗?谢谢
已邀请:

邹博 - 计算机科学博士,深谙机器学习算法原理

这个问题我没有遇到过。
如果是不使用Ananconda,直接在终端使用Python解释器,能够正常解释代码吗?
如果可以,就把matplotlib中的所有pyc文件删掉(放心删,它们会再次自动生成),或许可以解决。
如果还有问题,咱们继续讨论。
谢谢老师,我在Spyder中可以正常运行了,我试试老师的方法

您好,请问这个问题如何解决呢,IPython.core.error.UsageError: Invalid GUI request 'qt6'我现在出现了这样的错误,求告知


要回复问题请先登录注册