got “libatk-1.0.so.0: undefined symbol” when I tried ipython --pylab in Ubuntu 13.10

微笑、不失礼 提交于 2019-12-23 01:58:26

问题


I am currently using Ubuntu 13.10 and applied all the system updates. I have installed the Enthought Canopy (Version: 1.1.1.1452). And today when I tried to plot, I got nothing. After googling, I have run 'ipython --pylab' in command line but got the following message:

Matplotlib backend_wx and backend_wxagg require wxPython >=2.8

I could get into the interactive ipython shell but I still couldn't plot.

Then I follow the tips from user forum and I tried 'import wx' and got:

/usr/lib/x86_64-linux-gnu/libatk-1.0.so.0: undefined symbol: g_type_class_adjust_private_offset

Since I was able to use Canopy's plotting functionality a while ago, I suspect that Ubuntu's system update somehow introduces some library conflict with the current Canopy.

Anybody has a hint for me to solve this please? Thank you all very much!!


回答1:


Same problem, same system (Ubuntu 13.10, Canopy 1.1.1.1452), this is what worked for me. According to this post, the problem is wxPython and Canopy:

"We recommend that users who do not have a large wx-specific code base use the Qt backend rather than wx."

Here's how you can do that specifically for getting matplotlib to work with Qt (and solve your problem). To find out which is your current backend use matplotlib.get_backend() by:

>>> import matplotlib
>>> matplotlib.get_backend()
'WXAgg'

If you are seeing "WXAgg" like above, set the matplotlib backend to one of the known backends using matplotlib.use() as:

import matplotlib
matplotlib.use('QT4Agg')  

You can add the above in your script, or upon initializing a python session, and pyplot, pylab etc. would load without an error, for example:

import pylab  
from matplotlib import pylab                                       
from matplotlib import pyplot

Update:

A convenient way to configure the backend automatically is to edit the matplotlibrc configuration file. For Canopy the file is located in

~/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/mpl-data

In matplotlibrc, replace the line:

backend      : WXAgg

with:

backend      : Qt4Agg


来源:https://stackoverflow.com/questions/19956628/got-libatk-1-0-so-0-undefined-symbol-when-i-tried-ipython-pylab-in-ubuntu-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!