我曾在Windows 10上使用python 3.6来使用Pyinstaller(3.4),但这一次我在模块_pywrap_tensorflow_internal(tensorflow-gpu 1.12)上遇到了麻烦。 该程序可以在生成它的计算机上完美运行,但是在其他计算机(具有相同OS版本)上则存在路径问题。
我发现一些线程(Tensorflow-gpu with pyinstaller,Windows 10 pyinstaller tensorflow missing modules,https://github.com/pyinstaller/pyinstaller/issues/3754)讨论了类似的问题,但是建议的解决方案不适用于我的情况。
起初我遇到以下错误:
回溯(最近通话最近): swig_import_helper中的文件“ site-packages \ tensorflow \ python \ pywrap_tensorflow_internal.py”,第18行 find_module中的文件“ imp.py”,第297行 ImportError:没有名为“ _pywrap_tensorflow_internal”的模块
在处理上述异常期间,发生了另一个异常:
回溯(最近通话最近): 在第58行中,输入“ site-packages \ tensorflow \ python \ pywrap_tensorflow.py”文件 exec_module中的文件“ c:\ dev \ anaconda \ envs \ terminal \ lib \ site-packages \ PyInstaller \ loader \ pyimod03_importers.py”,行627 在第28行中输入文件“ site-packages \ tensorflow \ python \ pywrap_tensorflow_internal.py” swig_import_helper中的第20行的文件“ site-packages \ tensorflow \ python \ pywrap_tensorflow_internal.py” ImportError:DLL加载失败:找不到指定的模块。
在处理上述异常期间,发生了另一个异常:
回溯(最近通话最近): 文件“ hands_up_bending_counter_object_取向.py”,第12行,在 exec_module中的文件“ c:\ dev \ anaconda \ envs \ terminal \ lib \ site-packages \ PyInstaller \ loader \ pyimod03_importers.py”,行627 在第5行的文件“ tf_pose__init__.py”中 exec_module中的文件“ c:\ dev \ anaconda \ envs \ terminal \ lib \ site-packages \ PyInstaller \ loader \ pyimod03_importers.py”,行627 在第7行的文件“ tf_pose \ runner.py”中 exec_module中的文件“ c:\ dev \ anaconda \ envs \ terminal \ lib \ site-packages \ PyInstaller \ loader \ pyimod03_importers.py”,行627 在第3行的文件“ tf_pose \ common.py” exec_module中的文件“ c:\ dev \ anaconda \ envs \ terminal \ lib \ site-packages \ PyInstaller \ loader \ pyimod03_importers.py”,行627 在第24行的文件“ site-packages \ tensorflow__init __。py”中 exec_module中的文件“ c:\ dev \ anaconda \ envs \ terminal \ lib \ site-packages \ PyInstaller \ loader \ pyimod03_importers.py”,行627 在第49行的文件“ site-packages \ tensorflow \ python__init __。py”中 exec_module中的文件“ c:\ dev \ anaconda \ envs \ terminal \ lib \ site-packages \ PyInstaller \ loader \ pyimod03_importers.py”,行627 在第74行中输入文件“ site-packages \ tensorflow \ python \ pywrap_tensorflow.py” ImportError:追溯(最近一次呼叫最近): swig_import_helper中的文件“ site-packages \ tensorflow \ python \ pywrap_tensorflow_internal.py”,第18行 find_module中的文件“ imp.py”,第297行 ImportError:没有名为“ _pywrap_tensorflow_internal”的模块
在处理上述异常期间,发生了另一个异常:
回溯(最近通话最近): 在第58行中,输入“ site-packages \ tensorflow \ python \ pywrap_tensorflow.py”文件 exec_module中的文件“ c:\ dev \ anaconda \ envs \ terminal \ lib \ site-packages \ PyInstaller \ loader \ pyimod03_importers.py”,行627 在第28行中输入文件“ site-packages \ tensorflow \ python \ pywrap_tensorflow_internal.py” swig_import_helper中的第20行的文件“ site-packages \ tensorflow \ python \ pywrap_tensorflow_internal.py” ImportError:DLL加载失败:找不到指定的模块。
无法加载本机TensorFlow运行时。
请参见https://www.tensorflow.org/install/errors
出于某些常见原因和解决方案。包括整个堆栈跟踪 寻求帮助时,此错误消息上方。 [32124]无法执行脚本hands_up_bending_counter_object_取向
我已经尝试按照(https://github.com/pyinstaller/pyinstaller/issues/3754)的建议,将文件_pywrap_tensorflow_internal.pyd放置到dist文件夹中的子目录/tensorflow/python
中(通过修改.spec
文件),但是现在错误是:
回溯(最近通话最近): 在第58行中,输入“ site-packages \ tensorflow \ python \ pywrap_tensorflow.py”文件 exec_module中的文件“ c:\ dev \ anaconda \ envs \ terminal \ lib \ site-packages \ PyInstaller \ loader \ pyimod03_importers.py”,行627 在第28行中输入文件“ site-packages \ tensorflow \ python \ pywrap_tensorflow_internal.py” _pywrap_tensorflow_internal = swig_import_helper() swig_import_helper中的文件“ site-packages \ tensorflow \ python \ pywrap_tensorflow_internal.py”,第24行 _mod = imp.load_module('_ pywrap_tensorflow_internal',fp,路径名,描述) load_module中的文件“ imp.py”,第243行 在load_dynamic中的文件“ imp.py”,第343行 ImportError:DLL加载失败:找不到指定的模块。
在处理上述异常期间,发生了另一个异常:
回溯(最近通话最近): 在第11行的文件“ postural_analysis_fast.py” exec_module中的文件“ c:\ dev \ anaconda \ envs \ terminal \ lib \ site-packages \ PyInstaller \ loader \ pyimod03_importers.py”,行627 在第24行的文件“ site-packages \ tensorflow__init __。py”中 exec_module中的文件“ c:\ dev \ anaconda \ envs \ terminal \ lib \ site-packages \ PyInstaller \ loader \ pyimod03_importers.py”,行627 在第49行的文件“ site-packages \ tensorflow \ python__init __。py”中 exec_module中的文件“ c:\ dev \ anaconda \ envs \ terminal \ lib \ site-packages \ PyInstaller \ loader \ pyimod03_importers.py”,行627 在第74行中输入文件“ site-packages \ tensorflow \ python \ pywrap_tensorflow.py” ImportError:追溯(最近一次呼叫最近): 在第58行中,输入“ site-packages \ tensorflow \ python \ pywrap_tensorflow.py”文件 exec_module中的文件“ c:\ dev \ anaconda \ envs \ terminal \ lib \ site-packages \ PyInstaller \ loader \ pyimod03_importers.py”,行627 在第28行中输入文件“ site-packages \ tensorflow \ python \ pywrap_tensorflow_internal.py” swig_import_helper中的文件“ site-packages \ tensorflow \ python \ pywrap_tensorflow_internal.py”,第24行 load_module中的文件“ imp.py”,第243行 在load_dynamic中的文件“ imp.py”,第343行 ImportError:DLL加载失败:找不到指定的模块。
无法加载本机TensorFlow运行时。
请参见https://www.tensorflow.org/install/errors
出于某些常见原因和解决方案。包括整个堆栈跟踪 寻求帮助时,此错误消息上方。 [47340]无法执行脚本postural_analysis_fast。
编辑(24.04.2019):
我试图使用“依赖关系”工具来分析_pywrap_tensorflow_internal.pyd,结果如下:Dependencies result。
我无法在documentation of Dependencies中找到红色问号是什么意思(也许缺少dll?),但是所有这些dll已经存在于我的 dist 文件夹中(在主文件夹中) )。
答案 0 :(得分:0)
我面临同样的问题,并将依赖项工具应用于_pywrap_tensorflow_internal(tensorflow-gpu 1.12)。它需要一些C:\ WINDOWS \ system32文件,其中之一是nvcuda.dll。该cuda文件往往在其他计算机上丢失。希望这会有所帮助。
1)https://groups.google.com/a/tensorflow.org/forum/#!topic/discuss/-BluoQjTSLM