Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I'm setting up an autoclicker in Python 3.8 and I need win32api for GetAsyncKeyState but it always gives me this error:

>>> import win32api Traceback (most recent call last):   File "<stdin>", line 1, in <module> ImportError: DLL load failed while importing win32api: The specified module could not be found. 

I'm on Windows 10 Home 64x. I've already tried

pip install pypiwin32 

And it successfully installs but nothing changes. I tried uninstalling and re-installing python as well. I also tried installing 'django' in the same way and it actually works when I import django, so I think it's a win32api issue only.

>>> import win32api 

I expect the output to be none, but the actual output is always that error ^^

like image 891
Glxce Avatar asked Oct 29 '19 17:10

Glxce


People also ask

How do you solve Importerror DLL load failed the specified module could not be found?

importerror: dll load failed: The specified module could not be found error occurs because of the incompatibilities of Microsoft Visual C++ (Visual studio) versions. The best way to fix this error (importerror: dll load failed) is to reinstall/ install the Microsoft Visual C++ distribution.


1 Answers

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 
like image 155
Janzaib M Baloch Avatar answered Oct 06 '22 00:10

Janzaib M Baloch