MOON
MOON

Reputation: 2801

How to install PyGObject in Anaconda under Windows 10?

I tried to run this simple code, which is about GUI programming in python usinh Python GTK+ 3:

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk

win = Gtk.Window()
win.connect("destroy", Gtk.main_quit)
win.show_all()
Gtk.main()

I have anaconda 5.2 installed with Python 3.6 under Windows 10, and I get this error:

    import gi
ImportError: No module named 'gi'

Even if I install anaconda 4.2 with Python 3.5 I get the same error. I could not figure out how to install gi, which is apparently part of PyGObject. using pip install PyGObject results in an error:

 Failed building wheel for PyGObject

Can anybody help?

Upvotes: 1

Views: 3503

Answers (1)

Daniel F.
Daniel F.

Reputation: 1788

As I explain in this answer there are two ways (afaik) to install PyGObject in Windows.

If you use the .exe installer you'll be restricted to Python 3.4. I've never used it with Anaconda, but the installer (before automatically checking for Python interpreter installations) lets you select "portable" installations of the interpreter (I believe this might be the way to point to a virtual environment interpreter, maybe a conda installed interpreter, I've never used it though). You can try and let it try to find your interpreter automatically and if it doesn't then you can cancel the install and re try with the "portable" approach.

If you use MSYS2 I really don't know how you can make it work. You'll have to use the included pacman instead of Anaconda to manage your packages, so I don't know if this is what you want.

Upvotes: 1

Related Questions