How to know what to install (Ubuntu/Debian) for a given import?

Wildman best_lay at yahoo.com
Wed Feb 1 12:41:56 EST 2017


On Wed, 01 Feb 2017 17:12:26 +0000, Chris Green wrote:

> I'm often hitting this problem, how does one find out what package to
> install to provide what a give import needs?
> 
> Currently I'm modifying some code which has 'import gtk', I want to
> migrate from Python 2 to Python 3 if I can but at the moment the
> import fails in Python 3.
> 
> There are dozens of packages in the Ubuntu repositories which *might*
> provide what I need I don't want to try them all!  So, is there an
> easy way to find out?
> 
> ... and while I'm here, can someone tell me what package I need?

Try this:

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk

-- 
<Wildman> GNU/Linux user #557453
The cow died so I don't need your bull!



More information about the Python-list mailing list