From the second example for twin axes in AxesGrid1, where the intent was probably to have a "seconds of angle" symbol:
$ python
Python 3.5.1 (default, Dec 7 2015, 12:58:09)
[GCC 5.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib.pyplot as plt; plt.gca().set_xlabel("$^{''}$/yr"); plt.show()
<matplotlib.text.Text object at 0x7f6451604f98>
(same result from within ipython with %matplotlib active)

EDIT: This part is invalid and should be ignored
Weirdly enough, running the same command from with python -c a different result:
$ python -c 'import matplotlib.pyplot as plt; plt.gca().set_xlabel("$^{''}$/yr"); plt.show()'

(checked without any matplotlibrc).
Preempting @tacaswell to @zblz this time :-)
From the second example for twin axes in AxesGrid1, where the intent was probably to have a "seconds of angle" symbol:
(same result from within ipython with

%matplotlibactive)Preempting @tacaswell to @zblz this time :-)