[問題] pyautogui編譯成exe圖片無法定位

看板Python作者 (腳步)時間1年前 (2022/07/18 17:28), 編輯推噓2(2011)
留言13則, 5人參與, 1年前最新討論串1/2 (看更多)
python 3.10.4版 使用pyautogui圖片定位去模擬滑鼠去按某個功能 在還沒編譯console中執行,所有功能均正常 用pyinstaller跟nuitka編譯成exe後 圖片辨識地位都不能動了,定位也沒顯示None,沒錯誤 pyautogui.locateCenterOnScreen() 完全沒反應 grayscale跟confidence都有排列組合使用 python版本也用pyenv去嘗試3.7 3.6版使用 都是console中正常,exe後沒反應 請問大大們有沒有人有解? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 59.120.119.169 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1658136519.A.0D7.html

07/18 22:36, 1年前 , 1F
通靈
07/18 22:36, 1F

07/18 23:49, 1年前 , 2F
通靈
07/18 23:49, 2F

07/19 00:38, 1年前 , 3F
通靈是? 或者其他替代方案?
07/19 00:38, 3F

07/19 08:21, 1年前 , 4F
沒程式碼都是通靈
07/19 08:21, 4F

07/25 07:35, 1年前 , 5F
路徑寫絕對路徑若可以的話
07/25 07:35, 5F

07/25 07:36, 1年前 , 6F
是exe真正執行時,非在該exe路徑
07/25 07:36, 6F

07/25 07:38, 1年前 , 7F
python 轉成執行檔時,執行時不在原exe路徑
07/25 07:38, 7F

07/25 07:39, 1年前 , 8F
去找 pyrhon exe script 路徑怎麼取得
07/25 07:39, 8F

07/25 09:50, 1年前 , 9F
exec_path = ''
07/25 09:50, 9F

07/25 09:51, 1年前 , 10F
if hasattr(sys, "frozen"):
07/25 09:51, 10F

07/25 09:51, 1年前 , 11F
exec_path = os.path.dirname(sys.executable)
07/25 09:51, 11F

07/25 09:51, 1年前 , 12F
else:
07/25 09:51, 12F

07/25 09:51, 1年前 , 13F
exec_path = os.path.dirname(os.path.abspath(__fi
07/25 09:51, 13F
文章代碼(AID): #1YrIV73N (Python)
文章代碼(AID): #1YrIV73N (Python)