Tensorflow-gpu与pyinstaller

Ale*_*k89 6 python pyinstaller python-3.x tensorflow

试图分发一个依赖张量流的程序......

使用tensorflow,它可以很好地用作脚本和pyinstaller.使用tensorflow-gpu它可以作为脚本使用,但不能使用pyinstaller.cuda和cudnn dll已被pyinstaller复制到bundle文件夹中.

我使用python 3.6.5和tensorflow 1.7.0.(如果有帮助,可以更改版本......)

错误信息:

回溯(最近通话最后一个):文件"站点包\ tensorflow \蟒蛇\ pywrap_tensorflow.py" 58行,在文件"C:\用户\ ALEKS \应用程序数据\本地\程序\ python的\ python36\LIB \定点包\ PyInstaller \装载机\ pyimod03_importers.py "线路631,在exec_module EXEC(字节码,模块字典)文件"站点包\ tensorflow \蟒蛇\ pywrap_tensorflow_internal.py" 18行,在文件"站点包\ tensorflow\python\pywrap_tensorflow_internal.py",第17行,在swig_import_helper文件"importlib__init__.py",第126行,在import_module中ModuleNotFoundError:没有名为'tensorflow.python._pywrap_tensorflow_internal'的模块

在处理上述异常期间,发生了另一个异常:

回溯(最近通话最后一个):文件"interface.py",第14行,在文件"C:\用户\ ALEKS \应用程序数据\本地\程序\ python的\ python36\LIB \站点包\ PyInstaller \装载机\ pyimod03_importers. PY "线路631,在exec_module EXEC(字节码,模块字典)文件"站点包\ tensorflow__init __ PY"的第24行中的文件" C:\用户\ ALEKS \应用程序数据\本地\程序\ python的\ python36\LIB \站点包\ PyInstaller \装载机\ pyimod03_importers.py "线路631,在exec_module EXEC(字节码,模块.字典)文件"站点包\ tensorflow\python__init __ PY",线路49,在文件" C:\用户\ ALEKS \应用程序数据\本地\程序\ python的\ python36\LIB \站点包\ PyInstaller \装载机\ pyimod03_importers.py "线路631,在exec_module EXEC(字节码,模块字典)文件"站点包\ tensorflow \蟒蛇\ pywrap_tensorflow.py "74行,在导入错误:回溯(最近通话最后一个):文件"站点包\ tensorflow \蟒蛇\ pywrap_tensorflow.py" 58行,在文件" C:\用户\ ALEKS \应用程序数据\本地\程序\ python的\ python36\LIB \站点包\ PyInstaller \升 oader\pyimod03_importers.py",第631行,在exec_module exec中(字节码,模块.dict)文件"site-packages\tensorflow\python\pywrap_tensorflow_internal.py",第18行,在文件"site-packages\tensorflow\python\pywrap_tensorflow_internal.py"第17行,swig_import_helper文件"importlib__init__.py",第126行,在import_module中ModuleNotFoundError:没有名为'tensorflow.python._pywrap_tensorflow_internal'的模块

无法加载本机TensorFlow运行时.

请参阅https://www.tensorflow.org/install/install_sources#common_installation_problems

出于一些常见原因和解决方案.在寻求帮助时,请在此错误消息上方包括整个堆栈跟踪.[10816]无法执行脚本界面

Jos*_*ska 2

确保您还打包了MSVCP140.DLL,因为在 %PATH% 中缺少它可能会引发此错误。

在分发 TensorFlow 应用程序时,我倾向于使用 cx_Freeze 而不是 pyinstaller。一旦克服了 scipy 中 cx_Freeze 的错误,总体来说就更简单了。