Pycharm Import matplotlib package times wrong "backend Qt5agg is interactive backend"

Source: Internet
Author: User

The backend Qt5agg is interactive backend appears when you import the Matplotlib.pyplot as plt in the Pycharm python console. Turning interactive mode on. or other errors related to Qt5agg, causing the program to break.

Although it is not yet clear how the Qt5agg problem is solved, one can circumvent the problem (my environment is: pycharm 2017.2.3, PyQt5 5.9, PyQt4 4.11.4, Matplotlib 2.1.0, Ipython 5.3.0, Anaconda3, Python 3.6.0).

First of all, you can simply update the library of your environment, such as matplotlib, to ensure that your own matplotlib contains Tkagg. Modify the MATPLOTLIBRC file using the command Conda update matplotlib. The location of the file is in C:\ProgramData\Anaconda3\pkgs\matplotlib-2.1.0-py36h11b4b9c_0\Lib\site-packages. When you open the file, you will see the following text in about 30 lines. Modify the Qt5agg to Tkagg and save.

# the default backend; One of GTK Gtkagg Gtkcairo Gtk3agg Gtk3cairo
# MacOSX Qt4agg qt5agg tkagg WX wxagg Agg Cairo gdk PS PDF SVG
# Template.
# can also deploy your own backend outside of Matplotlib by
# referring to the module name (which must is in the Pythonpath) as
# ' Module://my_backend '.
#
# If You are omit this parameter, it'll always default to ' Agg ', which is a
# non-interactive Backend.
# Backend:qt5agg # Original
Backend:tkagg # New

If you want to import the Matplotlib.pylab as PLT, the backend Qt5agg is interactive backend does not appear. Turning interactive mode on. , you can modify the above file roughly 73 lines, the #interactive:false modified to interactive:true save. Then restart Pycharm, when the import Matplotlib.pylab as PLT, the normal operation.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.