Install gobject module?
Pip does not have it anymore. Check out the 'Getting Started' section here and install it based on your OS.
For accessibility, based on this question's tags, here's the "Ubuntu" section:
Installing the system provided PyGObject:
- Open a terminal
- Execute
sudo apt install python3-gi python3-gi-cairo gir1.2-gtk-3.0
- Change the directory to where your hello.py script can be found (e.g.
cd Desktop
)- Run
python3 hello.py
Installing from PyPI with pip:
- Open a terminal and enter your virtual environment
- Execute
sudo apt install libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-3.0
to install the build dependencies and GTK- Execute
pip3 install pycairo
to build and install Pycairo- Execute
pip3 install PyGObject
to build and install PyGObject- Change the working directory to where your
hello.py
script can be found- Run
python3 hello.py
Install python3-gi
and import it this way
from gi.repository import GObject
or so you don't have to rename all the references
from gi.repository import GObject as gobject