[英]cannot load matplotlib.pyplot with pycharm
I want to use pycharm as ide, however when i import matplotlib.pyplot as plt
in the pycharms python console i get the following error message: I want to use pycharm as ide, however when i
import matplotlib.pyplot as plt
in the pycharms python console i get the following error message:
Traceback (most recent call last):
File "/home/riechers/.local/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3326, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-5-a0d2faabd9e9>", line 1, in <module>
import matplotlib.pyplot as plt
File "/snap/pycharm-community/155/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/home/riechers/.local/lib/python3.6/site-packages/matplotlib/pyplot.py", line 2362, in <module>
install_repl_displayhook()
File "/home/riechers/.local/lib/python3.6/site-packages/matplotlib/pyplot.py", line 126, in install_repl_displayhook
ip.enable_gui(ipython_gui_name)
File "/snap/pycharm-community/155/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py", line 155, in enable_gui
return real_enable_gui(gui, app)
File "/snap/pycharm-community/155/helpers/pydev/pydev_ipython/inputhook.py", line 536, in enable_gui
return gui_hook(app)
File "/snap/pycharm-community/155/helpers/pydev/pydev_ipython/inputhook.py", line 413, in enable_gtk3
self.set_inputhook(create_inputhook_gtk3(self._stdin_file))
AttributeError: 'InputHookManager' object has no attribute '_stdin_file'
using ipython in the shell, there is no problem when executing the very same command.在 shell 中使用 ipython,执行相同的命令时没有问题。 I made sure pycharm uses the correct python version as interpreter.
我确保 pycharm 使用正确的 python 版本作为解释器。
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
https://stackoverflow.com/a/58205465/12343965 https://stackoverflow.com/a/58205465/12343965
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.