Help getting python code running with python 3 (with GUI)

Hitman928

Diamond Member
Apr 15, 2012
6,758
12,507
136
Hi,

I am not a programmer nor an expert with Linux, but have a task to get code that was written for python2 to run on python3. Alternatively I could just use python2 if I could figure out how to get pygtk installed/running with RHEL8.

When I try to run the script using python 2, I get the following error: ImportError: No module named pygtk. Obviously pygtk isn't installed or else isn't configured properly but I cannot figure out how to get it installed/configured correctly.

I found this:

https://askubuntu.com/questions/697397/python3-is-not-supporting-gtk-module

But trying to put the suggested lines into the script doesn't help, I get the following error: No module named gi. Perhaps I am not doing it correctly though (just put the lines at the start of the python script).

Any help with this would be greatly appreciated.
 
Feb 25, 2011
17,001
1,628
126
Google search for "how to install pip" and "how to install python modules using pip" - the exact command you'll use will be something along the lines of "python -m pip install pygtk" but there's some prerequisite steps first that can differ from system to system.

Afaik those libraries aren't part of the standard python installation, so yeah.