Gtk warning after ugrading to yosemite

2019-05-31 08:41发布

问题:

I am trying to run a program written in python on my mac (Yosemite). Almost immediately after starting the program it gives me the following error:

Gtk-WARNING **: Locale not supported by C library.
    Using the fallback 'C' locale.

[edit] tried to isolate the issue, the error appears upon entering

Adriaan$ ipython --gui=gtk
Python 2.7.8 (default, Nov  5 2014, 15:41:54) 
Type "copyright", "credits" or "license" for more information.

IPython 2.3.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

(process:969): Gtk-WARNING **: Locale not supported by C library.
    Using the fallback 'C' locale.

I have tried reinstalling X11(v2.7.7) and rebooting. (as listed in similar threads). Does anyone know how to resolve this error?

回答1:

Try to run Xquartz.app first. Then:

import matplotlib

matplotlib.use('TkAgg')

from matplotlib import pyplot 

Generally works for me after each OS upgrade.



标签: pygtk