ModuleNotFoundError: 没有名为“windows"的模块 [英] ModuleNotFoundError: No module named 'windows'
问题描述
我正在处理一个项目,我需要使用 PyMouse 模块.
I'm working on a project and I need to use the PyMouse module.
pip install pymouse
正确安装了pymouse,所以我认为一切都很好.但是,在导入 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.
我使用的是 Python 3.7 32 位
I'm using Python 3.7 32 bit
当前 pip 版本:18.1
Current pip version: 18.1
我有 Windows 10
I have Windows 10
在 64 位操作系统上工作
working on a 64-bit operating system
推荐答案
我曾经调查过这个问题,一开始很困惑,所以更深入地研究.事实证明,pymouse 绝对是错误的.更多的是我费心去寻找.您得到的错误只是由错误编码引起的众多错误之一.
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.
代码说:
from windows import PyMouse, PyMouseEvent
它应该说:
from .windows import PyMouse, PyMouseEvent
另外,PyUserInput
,一个没有pymouse
错误的姐妹包,需要pyhook
,python 3不支持它.环顾四周,得出的结论是发现的问题没有办法解决,除非安装一个非常早期的版本.
Also, PyUserInput
, a sister package that is free from the pymouse
errors, requires pyhook
, which is unsupported by python 3. After a lot of looking around, the conclusion that there is no way around the problems found, except maybe installing a really early version.
你也可以试试键盘模块.
You could also try the keyboard module.
这篇关于ModuleNotFoundError: 没有名为“windows"的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!