添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
拉风的勺子  ·  python ...·  17 小时前    · 
文雅的山楂  ·  [Code] python 字典 —— ...·  17 小时前    · 
活泼的硬盘  ·  jQuery UI 使用 | 菜鸟教程·  10 月前    · 
讲道义的紫菜汤  ·  Microsoft Edge ...·  1 年前    · 
从容的绿豆  ·  pandas labelencoder ...·  1 年前    · 
深情的围巾  ·  PowerToys Always on ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

import matplotlib.pyplot gives AttributeError: 'NoneType' object has no attribute 'is_interactive'

Ask Question
Traceback (most recent call last):
  File "D:\Program Files\Anaconda2\lib\site-packages\IPython\core\interactiveshell.py", line 2881, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-5-eff513f636fd>", line 1, in <module>
    import matplotlib.pyplot as plt
  File "D:\Program Files\JetBrains\PyCharm Community Edition 2016.2.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\Program Files\Anaconda2\lib\site-packages\matplotlib\pyplot.py", line 2512, in <module>
    install_repl_displayhook()
  File "D:\Program Files\Anaconda2\lib\site-packages\matplotlib\pyplot.py", line 165, in install_repl_displayhook
    ip.enable_gui(ipython_gui_name)
  File "D:\Program Files\JetBrains\PyCharm Community Edition 2016.2.3\helpers\pydev\_pydev_bundle\pydev_ipython_console_011.py", line 125, in enable_gui
    raise UsageError("%s" % e)
UsageError: Invalid GUI request 'qt5', valid ones are:['pyglet', 'osx', 'none', 'gtk3', 'tk', 'qt', 'glut', 'gtk', 'qt4', 'wx']
Traceback (most recent call last):
  File "D:\Program Files\Anaconda2\lib\site-packages\IPython\core\events.py", line 74, in trigger
    func(*args, **kwargs)
  File "D:\Program Files\Anaconda2\lib\site-packages\matplotlib\pyplot.py", line 147, in post_execute
    if matplotlib.is_interactive():
AttributeError: 'NoneType' object has no attribute 'is_interactive'
Error in callback <function post_execute at 0x0000000008AAD438> (for post_execute):

My python version:

Python 2.7.12 |Anaconda 4.2.0 (64-bit)| (default, Jun 29 2016, 11:07:13) [MSC v.1500 64 bit (AMD64)] on win32

But when I try to import matplotlib in Ipython, it works. Is there something wrong with my Pycharm console?

I have exactly the same problem. Identical Applications, version numbers and almost identical error. Unfortunately I also do not have a solution. – HeinzKurt Oct 26, 2016 at 16:54

I faced the exact same problem and proble is resolved after i upgraded pyCharm to 2016.03 version.

https://www.jetbrains.com/pycharm/download/#section=windows

I actually had the opposite problem in that starting Ipython failed with the same error (matplotlib.is_interactive())

I had %pylab inline as part of my Ipython startup settings (~/.ipython/profile_default/startup/start.ipy) that was messing things up, and removing it cleared up the issue. This started occurring after updating my version of Ipython and Anaconda.

My thought is something similar is happening behind the scenes for you. Perhaps setting up a similar startup script to do the opposite with the code @Chao provided might work.

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.