打包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文件的绝对路径)
可能出现
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、程序会生成一个dist文件夹,里面是labelme的可执行文件,可直接双击打开labelme