无法导入包:InputHookManager 的问题 [英] Unable to import package: Issues with InputHookManager

查看:26
本文介绍了无法导入包:InputHookManager 的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在花了最后一个小时左右试图解决这个问题,但失败了.我已经阅读了几个相关问题,例如 this,GitHub 问题,例如 this 但找不到如何最好地解决这个问题.

I have now spent the last hour or so trying to fix this issue but failed. I have read several related questions such as this, GitHub issues such as this but can't find how to best solve this issue.

导致错误的步骤

  1. 将 matplotlib.pyplot 导入为 plt

错误信息:

AttributeError: 'InputHookManager' 对象没有属性 '_stdin_file'

AttributeError: 'InputHookManager' object has no attribute '_stdin_file'

编辑

  1. 按如下方式导入会引发相同的错误(请参阅我的系统详细信息和下面的失败尝试):

from matplotlib import pyplot as plt

  1. 它在终端运行

失败的尝试

然后我打开了定义 InputHookManager 的文件,发现它与 ipythonpydev 有关系,所以我重新安装了 ipython 但是没有解决问题.

I then opened the file that defines InputHookManager and noticed that it had something to do with ipython and pydev so I reinstalled ipython but that didn't solve the issue.

我也尝试重新安装 matplotlib 无济于事.seaborn 会发生同样的错误,大概是因为它们都需要使用 gtk3.

I also tried reinstalling matplotlib to no avail. The same error happens with seaborn presumably because they both need to use gtk3.

有关系统的更多详细信息

python 3.6
pycharm community 2019.2.1
Ubuntu 18.04.3
matplotlib 3.1.1

推荐答案

如果 IPython 不起作用,请尝试以下操作.PyCharm 似乎对 Linux 中的交互模式不满意.

If IPython didn't work, try the following. PyCharm seems unhappy with the interactive mode in Linux.

import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt

这篇关于无法导入包:InputHookManager 的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆