Can't install win32gui
Question:
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:temppip-install-ycidig8uwin32guisetup.py", line 27, in <module>
from win32.distutils.gui import win32gui_build_ext
File "c:temppip-install-ycidig8uwin32guiwin32distutilsgui.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:temppip-install-ycidig8uwin32gui
I’m using python 3.7
I’ve upgraded the setuptools but it is still not working…
Answers:
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.
Install pywin32. That gives you win32gui.
pip install pywin32
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:python32python.exe Scriptspywin32_postinstall.py -install
Step 4: python
>>> import win32gui
All your needs you will satisfy in the module ctypes.
Use it and you won’t have any compatibility issues.
For example:
import ctypes
EnumWindows = ctypes.windll.user32.EnumWindows
GetWindowThreadProcessId = ctypes.windll.user32.GetWindowThreadProcessId
EnumWindowsProc = ctypes.WINFUNCTYPE(ctypes.c_bool, types.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int))
GetWindowText = ctypes.windll.user32.GetWindowTextW
GetWindowTextLength = ctypes.windll.user32.GetWindowTextLengthW
IsWindowVisible = ctypes.windll.user32.IsWindowVisible
IsWindowEnabled = ctypes.windll.user32.IsWindowEnabled
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:temppip-install-ycidig8uwin32guisetup.py", line 27, in <module>
from win32.distutils.gui import win32gui_build_ext
File "c:temppip-install-ycidig8uwin32guiwin32distutilsgui.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:temppip-install-ycidig8uwin32gui
I’m using python 3.7
I’ve upgraded the setuptools but it is still not working…
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.
Install pywin32. That gives you win32gui.
pip install pywin32
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:python32python.exe Scriptspywin32_postinstall.py -install
Step 4: python
>>> import win32gui
All your needs you will satisfy in the module ctypes.
Use it and you won’t have any compatibility issues.
For example:
import ctypes
EnumWindows = ctypes.windll.user32.EnumWindows
GetWindowThreadProcessId = ctypes.windll.user32.GetWindowThreadProcessId
EnumWindowsProc = ctypes.WINFUNCTYPE(ctypes.c_bool, types.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int))
GetWindowText = ctypes.windll.user32.GetWindowTextW
GetWindowTextLength = ctypes.windll.user32.GetWindowTextLengthW
IsWindowVisible = ctypes.windll.user32.IsWindowVisible
IsWindowEnabled = ctypes.windll.user32.IsWindowEnabled