Созданный exe из .py с использованием pyinstaller имеет проблемы с путь тензорного потока - PullRequest
0 голосов
/ 03 сентября 2018

Используя pyinstaller, я создал exe-скрипт из python. Скрипт имеет зависимость от тензорного потока. Пакет создан отлично. Проблема в том, когда я запускаю exe.

Python 3.6.5 Pyinstaller 3.3.1 Сборка платформы: Win 8.1 64bit Работающая платформа Win 7 64bit


C:\Program Files\test\FaceDetectionPackageBeta1\dist\FaceDetection>FaceDetection.exe
Using TensorFlow backend.
Traceback (most recent call last):
  File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 14,
 in swig_import_helper
  File "importlib\__init__.py", line 126, in import_module
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'tensorflow.python._pywrap_tensorflow_inter
nal'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <modu
le>
  File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_
importers.py", line 631, in exec_module
  File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17,
 in <module>
  File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 16,
 in swig_import_helper
  File "importlib\__init__.py", line 126, in import_module
  File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_
importers.py", line 714, in load_module
ImportError: DLL load failed with error code -1073741795

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "TELFaceDetection.py", line 12, in <module>
  File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_
importers.py", line 631, in exec_module
  File "site-packages\keras\__init__.py", line 3, in <module>
  File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_
importers.py", line 631, in exec_module
  File "site-packages\keras\utils\__init__.py", line 6, in <module>
  File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_
importers.py", line 631, in exec_module
  File "site-packages\keras\utils\conv_utils.py", line 9, in <module>
  File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_
importers.py", line 631, in exec_module
  File "site-packages\keras\backend\__init__.py", line 89, in <module>
  File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_
importers.py", line 631, in exec_module
  File "site-packages\keras\backend\tensorflow_backend.py", line 5, in <module>
  File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_
importers.py", line 631, in exec_module
  File "site-packages\tensorflow\__init__.py", line 24, in <module>
  File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_
importers.py", line 631, in exec_module
  File "site-packages\tensorflow\python\__init__.py", line 49, in <module>
  File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_
importers.py", line 631, in exec_module
  File "site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <modu
le>
ImportError: Traceback (most recent call last):
  File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 14,
 in swig_import_helper
  File "importlib\__init__.py", line 126, in import_module
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'tensorflow.python._pywrap_tensorflow_inter
nal'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <modu
le>
  File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_
importers.py", line 631, in exec_module
  File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17,
 in <module>
  File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 16,
 in swig_import_helper
  File "importlib\__init__.py", line 126, in import_module
  File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_
importers.py", line 714, in load_module
ImportError: DLL load failed with error code -1073741795


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_probl
ems

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.
[4988] Failed to execute script TELFaceDetection

Ниже приведен файл спецификации

# -*- mode: python -*-

block_cipher = None


a = Analysis(['FaceDetection.py'],
             pathex=['D:\\FaceDetectionSetup\\FaceDetectioPackageSource'],
             binaries=[],
             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,
          exclude_binaries=True,
          name='FaceDetection',
          debug=False,
          strip=False,
          upx=True,
          console=True )
coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               strip=False,
               upx=True,
               name='FaceDetection')

Я пробовал решение в ссылка , но это тоже не работает. когда я выполняю exe, Не получен модуль с именем tenorflow.python.framework.load_library Ошибка не получена.

Как мне установить путь, чтобы был выбран относительный путь. То же самое работало без проблем на 64-битной настольной системе Win 7. Так что работаю на одной системе, а не на другой. Любая помощь приветствуется.

Спасибо -Megha

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...