需要先 pip install pynput 关于pynput的监听键盘用法,请参见: https://pynput.readthedocs.io/en/latest/keyboard.html#monitoring-the-keyboard #PrntScr import time from PIL import ImageGrab, Image from pynput import keyboard #指定截图保存到目录 path = 'C:/Users/DELL/Desktop/0506/' #按键松开时执行,这里指定end键 def on_release(key) : if k