How to fix "ImportError: DLL load failed" while importing win32api How to fix "ImportError: DLL load failed" while importing win32api python python

How to fix "ImportError: DLL load failed" while importing win32api


Solved

If you are working in a miniconda on conda environment. You could just install pywin32 using conda instead of pip.

This solved my problem:

conda install pywin32


For my case, install and reinstall pywin32 doesn't help. After copied the two files from [installation directory of Anaconda]\Lib\site-packages\pywin32_system32 to C:\Windows\System32, it works.

My environment is python 3.8 in miniconda. The two files are pythoncom38.dll and pywintypes38.dll.


For me, it worked by downgrading my pywin32 from version 227 to version 224. Just type the following command on any shell in administrator mode:

pip install --upgrade pywin32==224