How to Install pywin32 in Python
Python for Window Extensions
pip install pywin32
What is pywin32?
Python for Window Extensions
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. See CHANGES.txt for recent notable changes. adodbapi's documentation can be found in: adodbapi/readme.txt isapi's documentation can be found in: isapi/README.txt Docs The docs are a long and sad story, but there's now an online version of the helpfile (thanks @ofek!). Lots of that is very old, but some is auto-generated and current. Would love help untangling the docs! You can get type hints, signatures and annotations from . Support Feel free to open issues for all bugs (or suspected bugs) in pywin32. pull-requests for all bugs or features are also welcome. However, please do not open GitHub issues for general support requests, or for problems or questions using the modules in this package. For pywin32 support requests, please start a discussion under the Q&A category. All non bug related issues will be converted into a discussion anyhow. The python-win32 mailing list is still available for general Python on Windows help requests. Type stubs currently live in typeshed. Any issue or request related to static type-checking and IntelliSense should be raised there. Binaries Binary releases are no longer supported. Build 306 was the last with .exe installers. You really shouldn't use them, but if you really need them, find them here Installing via PIP You should install pywin32 via pip - eg, There is a post-install script (see below) which should not be run inside virtual environments; it should only be run in "global" installs. For unreleased changes, you can download builds made by GitHub actions - choose any "workflow" from the branch and download its "artifacts" Installing globally Outside of a virtual environment you might want to install COM objects, services, etc. You can do this by executing: or (shorter but you don't have control over which python environment is used) If you do this with normal permissions it will be global for your user (a few files will be copied to the root of your Python install and some changes made to HKCU). If you execute this from an elevated process, it will be global for the machine (files will be copied to System32, HKLM will be changed, etc) Installing for MingGW/msys2 The folks at are graciously keeping an updated set of patches to install pywin32 for MingGW/msys2. We'd suggest installing from . We're open to seeing these patches be upstreamed in pywin32 if they can be tested automatically on the CI. Running as a Windows Service To run as a service, you probably want to install pywin32 globally from an elevated command prompt - see above. You also need to ensure Python is installed in a location where the user running the service has access to the installation and is able to load and . In particular, the account typically will not have access to your local directory structure. Troubleshooting If you encounter any problems when upgrading like the following: It usually means one of 2 things: You've upgraded an install where the post-install script was previously run. So you should run it again: or (shorter but you don't have control over which python environment is used) This will make some small attempts to cleanup older conflicting installs. There are other pywin32 DLLs installed in your system, but in a different location than the new ones. This sometimes happens in environments that come with pywin32 pre-shipped (eg, anaconda?). The possible solutions here are: Run the "postinstall" script documented above. Otherwise, find and remove all other copies of and (where is the Python version - eg, "39") Building from source Install Visual Studio 2019 (later probably works, but options might be different), follow the instructions in Build environment for the version you install. Then follow the Build instructions for the build itself (including ARM64 cross-compilation). Release process The following steps are performed when making a new release - this is mainly to form a checklist so @mhammond doesn't forget what to do :) Since build 307 the release process is based on the artifacts created by Github actions. Ensure CHANGES.txt has everything worth noting. Update the header to reflect the about-to-be released build and date, commit it. Update setup.py with the new build number. Update CHANGES.txt to have a new heading section for the next unreleased version. (ie, a new, empty "Coming in build XXX, as yet unreleased" section) Push these changes to GitHub, wait for the actions to complete, then download the artifacts from that run. Upload artifacts to pypi - we do this before pushing the tag because they might be rejected for an invalid . Done via . Create a new git tag for the release. Update setup.py with the new build number + ".1" (eg, 123.1), to ensure future test builds aren't mistaken for the real release. Make sure everything is pushed to GitHub, including the tag (ie, ) Send mail to python-win32 Older Manual Release Process This is the old process used when a local dev environment was used to create the builds. Build 306 was the last released with this process. Ensure CHANGES.txt has everything worth noting. Update the header to reflect the about-to-be released build and date, commit it. Update setup.py with the new build number. Execute , wait forever, test the artifacts. Upload .whl artifacts to pypi - we do this before pushing the tag because they might be rejected for an invalid . Done via . Commit setup.py (so the new build number is in the repo), create a new git tag Upload the .exe installers to GitHub. Update setup.py with the new build number + ".1" (eg, 123.1), to ensure future test builds aren't mistaken for the real release. Make sure everything is pushed to GitHub, including the tag (ie, ) * Send mail to python-win32
Quick Start
Minimal example to get started with pywin32:
import pywin32
print(pywin32.__version__)
Installation
pip (standard)
pip install pywin32
Virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install pywin32
pip3
pip3 install pywin32
conda
conda install -c conda-forge pywin32
Poetry
poetry add pywin32
Verify the Installation
After installing, confirm the package is available:
python -c "import pywin32; print(pywin32.__version__)"
If this prints a version number, installation succeeded. If you see a ModuleNotFoundError, see the errors section below.
Installation Errors
Common errors when installing pywin32 with pip.
ModuleNotFoundError: No module named 'pywin32'
Cause: The package is not installed in the current Python environment.
Fix: Run pip install pywin32. If using a virtual environment, ensure it is activated first.
ModuleNotFoundError: No module named 'pywin32' (installed but still failing)
Cause: pip installed the package into a different Python than the one running your script.
Fix: Use python -m pip install pywin32 to install into the interpreter you are running.
ImportError: cannot import name 'X' from 'pywin32'
Cause: The function or class does not exist in the installed version.
Fix: Check the version with pip show pywin32 and upgrade with pip install --upgrade pywin32.
pip: command not found
Cause: pip is not in PATH or Python was not added to PATH during installation.
Fix: Try python -m pip install pywin32. On macOS/Linux try pip3.
PermissionError: [Errno 13] Permission denied
Cause: No write access to the system Python package directory.
Fix: Use a virtual environment, or add --user: pip install --user pywin32
SSL: CERTIFICATE_VERIFY_FAILED
Cause: pip cannot verify PyPI's SSL certificate — common behind corporate proxies.
Fix: Try: pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org pywin32
Recent Releases
| Version | Released |
|---|---|
311 latest |
2025-07-14 |
310 |
2025-03-17 |
309 |
2025-03-09 |
308 |
2024-10-12 |
307 |
2024-10-04 |
Manage pywin32
Upgrade to latest version
pip install --upgrade pywin32
Install a specific version
pip install pywin32==311
Uninstall
pip uninstall pywin32
Check what is installed
pip show pywin32