Ruben
Ruben

Reputation: 1091

ImportError: No module named gtk

I have a PC running Ubuntu 17.10. I want to runn a python script that uses gtk. HoweverI get the following error:

Traceback (most recent call last):
  File "/usr/local/bin/selectvm.py", line 3, in <module>
    import gtk
ImportError: No module named gtk

I have tried already many things like:

sudo apt install python-gtk2 
sudo apt install python-gtk2-dev

but none of them works. APT says they are already installed.

Upvotes: 5

Views: 22485

Answers (2)

Lau
Lau

Reputation: 1

I managed to install it on 20.04 from the downloaded python-gtk2_2.24.0-5.1ubuntu2_amd64.deb file. Not from apt repository.

Upvotes: 0

Tuxonh
Tuxonh

Reputation: 27

Try:

sudo apt-get install python-gtk2

These are the python bindings for GTK.

Graphic package nessesary to build the software-center UI.

Or:

sudo apt-get install afnix

credits

Upvotes: 2

Related Questions