PyGObjectのインストールエラーを回避する方法

pipコマンドで PyGObjectをインストールしようとすると

$ pip3 install  PyGObject

以下のエラーが出る場合がある

Package gobject-introspection-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gobject-introspection-1.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gobject-introspection-1.0' found
Command '('pkg-config', '--print-errors', '--exists', 'gobject-introspection-1.0 >= 1.46.0')' returned non-zero exit status 1.
  
Try installing it with: 'sudo apt install libgirepository1.0-dev'
----------------------------------------
ERROR: Failed building wheel for PyGObject
Running setup.py clean for PyGObject
Failed to build PyGObject
ERROR: Could not build wheels for PyGObject which use PEP 517 and cannot be installed directly

エラーメッセージを読むと

Try installing it with: 'sudo apt install libgirepository1.0-dev'

と書いてあるように,aptで

$ sudo apt install libgirepository1.0-dev

libgirepository1.0-dev というパッケージをインストールしてから,再度

$ pip3 install  PyGObject

を実行すればこのエラーは回避できる