问题
I'm working on a project and I need to use the PyMouse module.
pip install pymouse
installed pymouse correctly, so I assumed all was fine. However, when importing PyMouse:
from pymouse import PyMouse
I got the following error running my program:
Traceback (most recent call last):
File "4opeenrij.py", line 1, in <module>
from pymouse import PyMouseEvent
File "C:\Users\lcdew\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pymouse\__init__.py", line 92, in <module>
from windows import PyMouse, PyMouseEvent
ModuleNotFoundError: No module named 'windows'
I can't seem to figure out what might cause this error message. Any help would be much appreciated.
Additional info:
I'm using Python 3.7 32 bit
Current pip version: 18.1
I have Windows 10
working on a 64-bit operating system
回答1:
I had I look into this and became puzzled at first, so looked deeper. It turns out that pymouse is absolutely full of errors. More that I bothered to find. The error you got is just one of many errors caused by bad coding.
The code says:
from windows import PyMouse, PyMouseEvent
And it should say:
from .windows import PyMouse, PyMouseEvent
Or:
from pymouse.windows import PyMouse, PyMouseEvent
Unfortunately, PyUserInput, a sister package that is free from the pymouse, requires pyhook, which is unsupported by 3.7, 3.6, and all recent versions. after a lot of looking around, i am forced to the conclusion that there is no way around the problems i have found except installing a really early version.
来源:https://stackoverflow.com/questions/53131954/modulenotfounderror-no-module-named-windows