【发布时间】:2021-10-30 13:05:08
【问题描述】:
我发现这是一个常见问题,但我还没有找到解决办法。我正在使用最新的 pycharm 社区,并且正在从 python 控制台运行一个脚本,但是每当我尝试加载 matplotlib 或 stellargraph 时,我都会得到以下信息:
Traceback (most recent call last):
File "/home/anthony/School/Research/Projects/my_code/venv/lib64/python3.8/site-packages/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3441, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-4-d181923c6965>", line 1, in <module>
exec(open('main.py').read())
File "<string>", line 5, in <module>
File "/snap/pycharm-community/250/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/home/anthony/School/Research/Projects/my_code/venv/lib64/python3.8/site-packages/lib/python3.8/site-packages/stellargraph/__init__.py", line 39, in <module>
from stellargraph import (
File "/snap/pycharm-community/250/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/home/anthony/School/Research/Projects/my_code/venv/lib64/python3.8/site-packages/lib/python3.8/site-packages/stellargraph/calibration.py", line 29, in <module>
import matplotlib.pyplot as plt
File "/snap/pycharm-community/250/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/home/anthony/.local/lib/python3.8/site-packages/matplotlib/pyplot.py", line 2507, in <module>
install_repl_displayhook()
File "/home/anthony/.local/lib/python3.8/site-packages/matplotlib/pyplot.py", line 156, in install_repl_displayhook
ip.enable_gui(ipython_gui_name)
File "/snap/pycharm-community/250/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py", line 156, in enable_gui
return real_enable_gui(gui, app)
File "/snap/pycharm-community/250/plugins/python-ce/helpers/pydev/pydev_ipython/inputhook.py", line 536, in enable_gui
return gui_hook(app)
File "/snap/pycharm-community/250/plugins/python-ce/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'
有没有人找到解决这个问题的方法?它是解释器中的设置还是控制台本身的设置?我检查了我也有 ipython。请帮忙!提前致谢。
【问题讨论】:
-
您尝试过这里列出的解决方案吗? stackoverflow.com/questions/58203394/…
-
@Sonia 他们将适用于 matplotlib,但不适用于 stellargraph。我检查了我的 ipython 及其最新版本。
-
能否将问题编辑为 stellargraph?由于它还提到了 matplotlib,我认为已经存在的解决方案可能会有所帮助:)
标签: python matplotlib pycharm backend stellargraph