pyinstaller打包人脸识别程序,带界面--过坑

1.fail to execute XXX

使用

import traceback
try:
    import face_recognition
except Exception as e:
    traceback.print_exc(file=open('error.log', 'w+'))

发现错误

RuntimeError: Unable to open D:\python3.6.2\Lib\site-packages\face_recognition_models\models\shape_predictor_68_face_landmarks.dat

2.思考到是该包没有打包,查看官方文档

https://pythonhosted.org/PyInstaller/spec-files.html#spec-file-operation

Analysis:
  • scripts: the python scripts named on the command line;命令行上命名的python脚本
  • pure: pure python modules needed by the scripts;脚本所需的纯python模块;
  • binaries: non-python modules needed by the scripts;脚本所需的非python模块;
  • datas: non-binary files included in the app。脚本所需的非二进制模块,如图标等资源;

3.参考https://blog.csdn.net/why19940926/article/details/82502261大哥的方法,导入

face_recognition_models是的程序成功运行。

 

结果示范

:pyinstaller打包人脸识别程序,带界面--过坑_第1张图片

pyinstaller打包人脸识别程序,带界面--过坑_第2张图片

你可能感兴趣的:(python,人脸识别)