欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程语言 > python >内容正文

python

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

发布时间:2023/12/10 python 44 豆豆
生活随笔 收集整理的这篇文章主要介绍了 python matplotlib.pyplot报错tk_@邹博,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[gui]

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(['none', 'osx', 'tk', 'gtk', 'wx', 'qt', 'qt4', 'glut', 'pyglet', 'gtk3'])

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(['none', 'osx', 'tk', 'gtk', 'wx', 'qt', 'qt4', 'glut', 'pyglet', 'gtk3'])

在网上查了一圈都没搞定,老师能帮忙解决下吗?谢谢

总结

以上是生活随笔为你收集整理的python matplotlib.pyplot报错tk_@邹博,python 中 import matplotlib.pyplot 会报Keyerror 'qt5' 的错...的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。