打包labelme為exe文件,簡化操作,在沒有安裝python和anocanda的情況下也能適用
1、下載labelme源碼
https://github.com/wkentaro/labelme/releases
2、安裝pyinstaller
pip install pyinstaller
3、解壓labelme源碼,找到labelme.spec文件
4、pyinsalller -F (labelme.spec文件的絕對路徑)
建議先pyinstaller -F labelme/main.py ,將缺少的包先裝上,再pyinsalller -F (labelme.spec文件的絕對路徑)
可能出現(xiàn)
1)RecursionError: maximum recursion depth exceeded while calling a Python object
則在labelme.spec中
第三行加入
import sys
sys.setrecursionlimit(1000000)
2)UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xce in position 110: invalid continuation byte
則修改anocanda 中site-packages\PyInstaller\compat.py
out = out.decode(encoding)
改成
out = out.decode(encoding, errors='ignore')
5、程序會生成一個(gè)dist文件夾,里面是labelme的可執(zhí)行文件,可直接雙擊打開labelme