python3.4 pip install pyautogui 有错误
改为安装低版本就能正常使用了:
pip install pyautogui==0.9.0
import time
import pyautogui as pag
import os
try:
while True:
print("Press Ctrl-C to end")
screenWidth, screenHeight = pag.size() # 获取屏幕的尺寸
x, y = pag.position() # 返回鼠标的坐标
print("Screen size: (%s %s), Position : (%s, %s)\n" % (screenWidth, screenHeight, x, y)) # 打印坐标
time.sleep(0.5) # 每0.5s中打印一次 , 并执行清屏
os.system('cls') # 执行系统清屏指令
except KeyboardInterrupt:
print('end')
已经用pyinstaller打包好了:
下载地址:https://download.csdn.net/download/weixin_44345526/15137080