Search code examples
pythonpywin32win32gui

Issues with importing win32gui python 3.9


I'm trying to use win32gui from pywin32 but I keep getting this error:

ModuleNotFoundError: No module named 'win32gui'

I am on windows 10, python 3.9

I have been researching the top results on stack over flow and google for a while now and the solutions i found don't work for me.

things I have tried:

  • installed pywin32 via a whl file (this shows in site packages along with win32 ect)
  • double checked both 64bit versions of python and pywin32 are installed
  • Added pywin32 to Path (worth a try)
  • tried "from win32 import win32gui"

Any help would be appreciated!

Requested commands with output:

importing win32api and win32com results in the same out of

  • ModuleNotFoundError: No module named 'win32api'
  • ModuleNotFoundError: No module named 'win32com'

python -m pip install pywin32 Requirement already satisfied: pywin32 in c:\users\user\appdata\local\programs\python\python39\lib\site-packages (304.0)

python -c "import win32gui" -- nothing happens when i run this line in a cmd (maybe i have done something wrong here?)


Solution

  • Solution unknown however it was fixed by simply recreating the virtual environment and installing the pywin32.