20
votes

I'm trying to install win32gui with pip but I get an error:

C:\Users\משתמש>pip install win32gui

Collecting win32gui
Using cached https://files.pythonhosted.org/packages/b8/75/7bed82934e51903f9d48b26b3996161bb2dce1731607b4bb7fd26003ed3e/win32gui-221.5.tar.gz
Installing build dependencies ... done
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\temp\pip-install-ycidig8u\win32gui\setup.py", line 27, in <module>
from win32.distutils.gui import win32gui_build_ext
File "c:\temp\pip-install-ycidig8u\win32gui\win32\distutils\gui.py", line 6, in <module>
from .command import win32_build_ext
ModuleNotFoundError: No module named 'win32.distutils.command'
----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in c:\temp\pip-install-ycidig8u\win32gui\

I'm using python 3.7 I've upgraded the setuptools but it is still not working...

3
It may be trying to build the extension and you don't have something required to do that. I usually get a pre-built version from Christoph Gohlke's UCI web site. Just search for "PyWin32", - martineau

3 Answers

27
votes

Win32gui isn't compatible with 3.7.

3.7 was realeased in 2018 and the latest version of win32gui was released in August 2017.

I would suggest installing 3.6 or lower as a workaround.

EDIT:

The answer by @bronson beat me to it by 9 days, but installing pywin32 with pip install pywin32 will install win32gui alongside modules for interfacing with windows.

45
votes

Install pywin32. That gives you win32gui.

pip install pywin32

0
votes

See this link: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pywin32. It may be of help to you.

Step 1: Download the pywin32....whl
Step 2: pip install pywin32....whl
Step 3: C:\python32\python.exe Scripts\pywin32_postinstall.py -install
Step 4: python
>>> import win32gui

enter image description here