qq_20079359
2021-10-28 14:36
采纳率: 44.4%
浏览 80
已结题

python中使用pyautogui.locateCenterOnScreen()代码时出错 求解


import pyautogui
a = pyautogui.locateCenterOnScreen('sdr.png')
print(a)

Traceback (most recent call last):
  File "C:\Users\97817\PycharmProjects\pythonProject\demo.py", line 2, in <module>
    a = pyautogui.locateCenterOnScreen('sdr.png')
  File "C:\Users\97817\AppData\Local\Programs\Python\Python39\lib\site-packages\pyscreeze-0.1.28-py3.9.egg\pyscreeze\__init__.py", line 413, in locateCenterOnScreen
  File "C:\Users\97817\AppData\Local\Programs\Python\Python39\lib\site-packages\pyscreeze-0.1.28-py3.9.egg\pyscreeze\__init__.py", line 373, in locateOnScreen
  File "C:\Users\97817\AppData\Local\Programs\Python\Python39\lib\site-packages\pyscreeze-0.1.28-py3.9.egg\pyscreeze\__init__.py", line 353, in locate
  File "C:\Users\97817\AppData\Local\Programs\Python\Python39\lib\site-packages\pyscreeze-0.1.28-py3.9.egg\pyscreeze\__init__.py", line 262, in _locateAll_python
FileNotFoundError: [Errno 2] No such file or directory: 'sdr.png'
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • 辉煌仪奇 2021-10-28 14:38
    已采纳

    没有找到sdr.png
    你将sdr.png放置在demo.py同目录下即可

    评论
    解决 无用 1
    打赏 举报

相关推荐 更多相似问题