I am using Python 2.7
and I want to use pywin32-214
on Windows 7
. I installed pywin32-214
by using the msi
installer. But when I import win32api
in my Python script, it throws the error:
no module named win32api.
What should I do? Can I use pywin32 api
for Windows 7
?
This is resolve my case as found on Where to find the win32api module for Python?
pip install pypiwin32
The following should work:
pip install pywin32
But it didn't for me. I fixed this by downloading and installing the exe from here:
I had an identical problem, which I solved by restarting my Python editor and shell. I had installed pywin32
but the new modules were not picked up until the restarts.
If you've already done that, do a search in your Python installation for win32api
and you should find win32api.pyd
under ${PYTHON_HOME}\Lib\site-packages\win32
.
After installing pywin32
Steps to correctly install your module (pywin32)
First search where is your python pip is present
1a. For Example in my case location of pip - C:\Users\username\AppData\Local\Programs\Python\Python36-32\Scripts
Then open your command prompt and change directory to your pip folder location.
cd C:\Users\username\AppData\Local\Programs\Python\Python36-32\Scripts
C:\Users\username\AppData\Local\Programs\Python\Python36-32\Scripts>pip install
pypiwin32
Restart your IDE
All done now you can use the module .
I didn't find the package of the most voted answer in my Python 3 dist.
I had the same problem and solved it installing the module pywin32:
In a normal python:
pip install pywin32
In anaconda:
conda install pywin32
My python installation (IntelĀ® Distribution for Python) had some kind of dependency problem and was giving this error. After installing this module it stopped appearing.
According to pywin32 github you must run
pip install pywin32
and after that, you must run
python Scripts/pywin32_postinstall.py -install
I know I'm reviving an old thread, but I just had this problem and this was the only way to solve it.
I had both pywin32
and pipywin32
installed like suggested in previous answer, but I still did not have a folder ${PYTHON_HOME}\Lib\site-packages\win32
.
This always lead to errors when trying import win32api
.
The simple solution was to uninstall both packages and reinstall pywin32
:
pip uninstall pipywin32
pip uninstall pywin32
pip install pywin32
Then restart Python (and Jupyter).
Now, the win32
folder is there and the import works fine. Problem solved.
Source: Stackoverflow.com