Reputation: 145
i am trying to use PyMouse plugin on windows 8.1 . i used this code to import library :
from pymouse.windows import PyMouse
but this error shows :
from win32api import GetSystemMetrics ImportError: No module named 'win32api'
where is the problem? i am not sure that i install the library fine ! can you show how to install it on windows ?
Upvotes: 3
Views: 8029
Reputation: 365747
The win32api
module is part of PyWin32
, so you need to install that.
Meanwhile, you should be installing things with pip
whenever possible. Some packages aren't pip
-installable, or have incorrect requirements specs, but most packages, if you try to pip
install them, will either automatically fetch their dependencies or complain that they're missing.
Also it looks like PyMouse's documentation is wrong, because it claims to only require ctypes
(which comes with Python 2.6+), not PyWin32
, on Windows. You may want to file a documentation bug with them.
However, it looks like the PyMouse
you were using was abandoned at version 0.4 about 6 years ago. It was then picked up by someone else, but, as the README says, it was later merged into PyUserInput
. So, you probably want to use that instead.
Note that PyUserInput
correctly mentions the other dependencies in its README. It also checks them in its setup.py
file. So hopefully, all you have to do is:
pip install PyUserInput
… and it will either pull in PyWin32 and pyHook, or complain that you have to go get them manually.
Upvotes: 2