1.安装

brew install cliclick

2.使用

# 打印当前鼠标位置
$ /usr/local/bin/cliclick p
# 点击指定位置坐标
$ /usr/local/bin/cliclick c:x,y (x横坐标,y纵坐标)

3.python代码

import os
import time

cmd1 = "/usr/local/bin/cliclick c:3451,392"
for i in range(5):
    mess1 = os.system(cmd1)
    print(mess1)
    time.sleep(1)
    print('----' + str(i+1) + '------')