Я создал exe, используя pyinstaller проекта python kivy. EXE отлично работает на моей машине разработки, но не на другой машине windows. Я изменил файл spe c и создал .exe из командной строки, а не внутри IDE-терминала (PyCharm).
Когда я запускаю exe, строка импорта main.py face_recognition не работает
C:\myexe\main\dist>Faces.exe
Traceback (most recent call last):
File "main.py", line 12, in <module>
File "c:\users\thoma\pycharmprojects\facesapp\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
File "face_recognition\__init__.py", line 7, in <module>
File "c:\users\thoma\pycharmprojects\facesapp\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
File "face_recognition\api.py", line 4, in <module>
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.
[5108] Failed to execute script main
my spe c file:
# -*- mode: python -*-
from kivy_deps import glew, sdl2
Tree('C:\\myexe\\'),
*[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)],
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(['main.py'],
pathex=['C:\\myexe\\'],
binaries=face_models,
datas=[('C:\\myexe\\main.kv', '.')],
hiddenimports=['scipy._lib.messagestream', 'scipy', 'scipy.signal', 'scipy.signal.bsplines', 'scipy.special', 'scipy.special._ufuncs_cxx',
'scipy.linalg.cython_blas',
'scipy.linalg.cython_lapack',
'scipy.integrate',
'scipy.integrate.quadrature',
'scipy.integrate.odepack',
'scipy.integrate._odepack',
'scipy.integrate.quadpack',
'scipy.integrate._quadpack',
'scipy.integrate._ode',
'scipy.integrate.vode',
'scipy.integrate._dop', 'scipy._lib', 'scipy._build_utils','scipy.__config__',
'scipy.integrate.lsoda', 'scipy.cluster', 'scipy.constants','scipy.fftpack','scipy.interpolate','scipy.io','scipy.linalg','scipy.misc','scipy.ndimage','scipy.odr','scipy.optimize','scipy.setup','scipy.sparse','scipy.spatial','scipy.special','scipy.stats','scipy.version','win32file', 'win32timezone'],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
a.datas += Tree('./scipy_extra', prefix=None)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='Faces',
debug=False,
strip=False,
upx=True,
runtime_tmpdir=None,
console=True )
C:\myexe>pip install face_recognition
Requirement already satisfied: face_recognition in c:\users\thoma\appdata\local\programs\python\python37\lib\site-packages (1.3.0)
Requirement already satisfied: Click>=6.0 in c:\users\thoma\appdata\local\programs\python\python37\lib\site-packages (from face_recognition) (7.1.2)
Requirement already satisfied: Pillow in c:\users\thoma\appdata\local\programs\python\python37\lib\site-packages (from face_recognition) (7.2.0)
Requirement already satisfied: numpy in c:\users\thoma\appdata\local\programs\python\python37\lib\site-packages (from face_recognition) (1.19.1)
Requirement already satisfied: face-recognition-models>=0.3.0 in c:\users\thoma\appdata\local\programs\python\python37\lib\site-packages (from face_recognition) (0.3.0)
Requirement already satisfied: dlib>=19.7 in c:\users\thoma\appdata\local\programs\python\python37\lib\site-packages (from face_recognition) (19.20.0)
Как я могу запустить этот exe с помощью библиотеки face_recognition, включенной в каталог или установленной локально?