To configure Python Matplotlib to display to GUI/X. You need to configure Matplotlib backend to be 'TKAgg' (default is Agg).

Problem:Most Python compilers delivered with major Linux distributions don't have tcl/tk configured during the build. To test, try 'import Tkinter' in your Python. The underlying shared object is _tkinter.so. Tkinter is required by Matplotlib to enable TKAgg backend.

If your Python is not configured for Tk, you will need to rebuild Python compiler with tcl/tk and possibly rebuild matplotlib.

The key of configuring tcl/tk for Python compiler is to include tcl/tk header files while building Python compiler.

If you don't have root on the system, the best way is to download tcl/tk. Otherwise, you can just rpm tcl/tk devel RPMs. In either cases, you should install the correct version of header files as your system tcl/tk binary/libs.

Below are the detail steps to build everything from source code, it takes about 1 hour.

run the examples that use tkanimation example code: animate_decay_tk_blit.pymplot3d example code: 2dcollections3d_demo.py

6. As long as your newly build and system python compilers are the same version and build with the same paramters (ucs), you should be able to run all your existing python codes/modules with the new compiler. But the best way is your System Adminsitrator update the system wide Python compile with tcl/tk following this guide.

Reference 1:

To check your Python is built with ucs2 or ucs41. ucs4>>> import sys>>> print sys.maxunicode1114111