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是的程序成功運行。

 

結果示範

:

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章