zoukankan      html  css  js  c++  java
  • Python3.7 Pyinstaller 打包Face_Recognition程序

    问题

    直接使用pyinstaller -F test.py 进行打包,之后运行exe会报错
    image

    解决方法

    将dat文件打包到exe中
    修改spec文件

    # -*- mode: python -*-
    
    block_cipher = None
    
    face_models = [
    ('.\face_recognition_models\models\dlib_face_recognition_resnet_model_v1.dat', './face_recognition_models/models'),
    ('.\face_recognition_models\models\mmod_human_face_detector.dat', './face_recognition_models/models'),
    ('.\face_recognition_models\models\shape_predictor_5_face_landmarks.dat', './face_recognition_models/models'),
    ('.\face_recognition_models\models\shape_predictor_68_face_landmarks.dat', './face_recognition_models/models'),
    ]
    
    a = Analysis(['xxx.py'],
                 pathex=['C:\Users\pc\Desktop\test'],
                 binaries=face_models,
                 datas=[],
                 hiddenimports=[],
                 hookspath=[],
                 runtime_hooks=[],
                 excludes=[],
                 win_no_prefer_redirects=False,
                 win_private_assemblies=False,
                 cipher=block_cipher)
    
    pyz = PYZ(a.pure, a.zipped_data,
                 cipher=block_cipher)
    exe = EXE(pyz,
              a.scripts,
              a.binaries,
              a.zipfiles,
              a.datas,
              name='xxx',
              debug=False,
              strip=False,
              upx=True,
              runtime_tmpdir=None,
              console=True )
    
    不论你在什么时候开始,重要的是开始之后就不要停止。 不论你在什么时候结束,重要的是结束之后就不要悔恨。
  • 相关阅读:
    小错误
    创建表空间
    mysql
    myeclipse
    linux命令小结
    jquery
    java基础
    【学习笔记】【多项式】多项式插值相关_个人学习用
    SHUoj 神无月排位赛
    SHUoj 字符串进制转换
  • 原文地址:https://www.cnblogs.com/yunhgu/p/15117787.html
Copyright © 2011-2022 走看看