The problem is that the developers of pygobject3 have written their install instructions that does NOT consider pip/conda. If you follow the official documentation:
- Have to use the homebrew python installation (the one installed when you go
brew install python
)
brew install gtk+3
is NOT compatible with non homebrew Pip/Conda python installs. You have to build the GTK3 package manually to use the pip version of pygobject3.
However if you want to use conda, thanks to this conda contributor, there is a pre-built conda gtk3 package you can use, you just have to get it from his channel:
Make a new environment using conda:
conda create --name my_env
install pygobject3 from conda
conda install pygobject
install gtk3 from the pkgw-forge channel
conda install -c pkgw-forge gtk3
To verify, open python from within the conda env and run
import gi
gi.require_version("Gtk", "3.0")
Should get no errors
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…