如何在虚拟机上使用 pyautogui?
How do I use pyautogui on Virtual machine?
我有一段代码在我的电脑上运行良好:
updated=0
while updated==0:
w=pyautogui.getWindows()
lw=list(w)
if strg in lw:
time.sleep(1)
else:
updated=updated+1
time.sleep(0.1)
pyautogui.press('enter')
break
但是当我在 Oracle 的 VM VirtualBox 上 运行 它时,我得到错误:
AttributeError: module 'pyautogui' has no attribute 'getWindows'
我尝试重新安装 PyAutoGui 并查找同名文件,但没有成功。有人可以帮我解决这个错误吗?
要了解您的 PC 和 VirtualBox 之间的区别,请检查两者:
模块路径
print(pyautogui.__file__)
模块版本
print(pyautogui.__version__)
模块可用methods/attributes
print(dir(pyautogui))
你可以使用
pyautogui.getAllWindows()
代替
pyautogui.getWindows()
我有一段代码在我的电脑上运行良好:
updated=0
while updated==0:
w=pyautogui.getWindows()
lw=list(w)
if strg in lw:
time.sleep(1)
else:
updated=updated+1
time.sleep(0.1)
pyautogui.press('enter')
break
但是当我在 Oracle 的 VM VirtualBox 上 运行 它时,我得到错误:
AttributeError: module 'pyautogui' has no attribute 'getWindows'
我尝试重新安装 PyAutoGui 并查找同名文件,但没有成功。有人可以帮我解决这个错误吗?
要了解您的 PC 和 VirtualBox 之间的区别,请检查两者:
模块路径
print(pyautogui.__file__)
模块版本
print(pyautogui.__version__)
模块可用methods/attributes
print(dir(pyautogui))
你可以使用
pyautogui.getAllWindows()
代替
pyautogui.getWindows()