日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學(xué)無先后,達(dá)者為師

網(wǎng)站首頁 編程語言 正文

pyinstaller打包exe時(shí)報(bào)錯(cuò)問題記錄[makespec options not valid when a.spec file is given]

作者:小宋同學(xué)-- 更新時(shí)間: 2023-12-13 編程語言
一、簡(jiǎn)介

最近用pyautogui庫寫了一個(gè)自動(dòng)化操作的小程序,為了提高識(shí)別效率,使用了confidence參數(shù),代碼為xy = pyautogui.locateCenterOnScreen(p,grayscale= False,confidence=0.8),其中p為待識(shí)別圖片參數(shù),confidence:表示灰度值。程序完成后運(yùn)行沒有異常,然后封裝時(shí)出現(xiàn)一些問題,下面列出兩個(gè)主要的BUG。

二、報(bào)錯(cuò)問題

1. 報(bào)出錯(cuò)誤【makespec options not valid when a.spec file is given】

因程序中引用多張圖片資源,故封裝時(shí)參照該篇博客打包https://blog.csdn.net/xue_11/article/details/117923245
使用指令為
pyi-makespec -F test.py 第一步生成spec文件
pyinstaller -F test.spec 第二步常規(guī)打包為exe文件
在運(yùn)行第二步時(shí)就報(bào)出makespec options not valid when a.spec file is given錯(cuò)誤

解決方法:將-F去掉封裝成功

2. 報(bào)出錯(cuò)誤【NotImplementedError: The confidence keyword argument is only available if OpenCV is install】

封裝成功后,運(yùn)行嘗試,想不到閃退,仔細(xì)看才發(fā)現(xiàn)是報(bào)出NotImplementedError: The confidence keyword argument is only available if OpenCV is install,大致意思是“confidence關(guān)鍵字參數(shù)僅在OpenCV安裝時(shí)可用”,問了一個(gè)大佬,才發(fā)現(xiàn)是Pyinstaller與OpenCV版本沖突所致。

解決辦法:將原版本的OpenCV卸載,重新安裝OpenCV4.5.3.56解決
安裝命令:pip install opencv-python==4.5.3.56

原文鏈接:https://blog.csdn.net/xue_11/article/details/128765956

  • 上一篇:沒有了
  • 下一篇:沒有了
欄目分類
最近更新