mport tensorflowwwwhj6666com时会出现如下错误13094399995
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mport tensorflowwwwhj6666com时会出现如下错误13094399995相关的知识,希望对你有一定的参考价值。
Windows Server安装tensorflow后ImportError错误完美解决
原创 数据观世界 2018-11-24 22:42:29
Windows Server安装tensorflow后ImportError错误完美解决
数据观世界
近期由于学术需要,需要在服务器上跑深度神经网络,我们的网络代码是基于tensorflow的,所以首要的就是要在服务器上安装Python和tensorflow。
我们的环境是:
tensorflow 1.12.0
所有的一切都很顺利,包括tensorflow的安装(pip install tensorflow),但在运行代码时或者在python命令行下运行import tensorflow时,会出现如下错误:
File “D:Python35libsite-packages ensorflowpythonpywrap_tensorflow.py”, l ine 41, infrom tensorflow.python.pywrap_tensorflow_internal import *
File “D:Python35libsite-packages ensorflowpythonpywrap_tensorflow_intern al.py”, line 21, in_pywrap_tensorflow_internal = swig_import_helper()
File “D:Python35libsite-packages ensorflowpythonpywrap_tensorflow_intern al.py”, line 20, in swig_import_helperreturn importlib.import_module(‘pywrap_tensorflow_internal’)
File “D:Python35libimportlib_init.py”, line 126, in import_modulereturn _bootstrap._gcd_import(name[level:], package, level) ImportError: No module named ‘_pywrap_tensorflow_internal’
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “ “, line 1, inFile “D:Python35libsite-packages ensorflowinit.py”, line 24, infrom tensorflow.python import *
File “D:Python35libsite-packages ensorflowpythoninit.py”, line 51, i nfrom tensorflow.python import pywraptensorflow
File “D:Python35libsite-packages ensorflowpythonpywrap_tensorflow.py”, l ine 52, inraise ImportError(msg) ImportError: Traceback (most recent call last):
File “D:Python35libsite-packages ensorflowpythonpywrap_tensorflow_intern al.py”, line 18, in swig_import_helperreturn importlib.import_module(mname)
File “D:Python35libimportlib_init.py”, line 126, in import_modulereturn _bootstrap._gcd_import(name[level:], package, level)
File “ “, line 986, in _gcd_import File “ “, line 969, in _find_and_load File “ “, line 958, in _find_and_load_unlocked
File “ “, line 666, in _load_unlocked
File “ “, line 577, in module_from_spec
File “ “, line 906, in create_module File “ “, line 222, in _call_with_frames_removed ImportError: DLL load failed: 找不到指定的模块。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “D:Python35libsite-packages ensorflowpythonpywrap_tensorflow.py”, l ine 41, infrom tensorflow.python.pywrap_tensorflow_internal import *
File “D:Python35libsite-packages ensorflowpythonpywrap_tensorflow_intern al.py”, line 21, in_pywrap_tensorflow_internal = swig_import_helper()
File “D:Python35libsite-packages ensorflowpythonpywrap_tensorflow_intern al.py”, line 20, in swig_import_helperreturn importlib.import_module(‘pywrap_tensorflow_internal’)
File “D:Python35libimportlib_init.py”, line 126, in import_modulereturn _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named ‘_pywrap_tensorflow_internal’
Failed to load the native TensorFlow runtime.
See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_st arted/os_setup.md#import_errorfor some common reasons and solutions. Include the entire stack trace above this error message when asking for help.
您遇到的错误可能不完全一样,但是如果在使用时出现类似的DLL load failed 或者 ImportError错误提示,本文都可以为您提供参考。
为了解决这个问题,我浪费了大量的时间。这个过程中我感觉内心是极其煎熬的,明知道是一个很小的错误,却不知道该怎么解决。而且发现网上相关的问题搜索结果极少,所以发此文,希望为大家提供到帮助。
Windows Server安装tensorflow后ImportError错误完美解决
最后我找到的解决办法,就是安装C++ 2015 Redistributable Update 3。您可以从这里下载:https://www.microsoft.com/en-us/download/details.aspx?id=53587,按照提示下载安装之后,在python命令行下import tensorflow的错误就完全消失了,运行深度神经网络代码文件也再没出现过问题。
通过此方法完美解决,也许这是我的个例。如果你通过上面这个方法没有完全解决问题,请参考下面的方法:
从https://gist.github.com/mrry/ee5dbcfdd045fa48a27d56664411d41c,下载文件:tensorflow_self_check.py,在本地运行此文件,便可自动检测您的运行环境存在的详细问题。
该文件运行结果可能会反馈给您多条待解决的问题,根据个人经历,我建议您从第一条开始,解决一条问题之后,然后用import tensorflow测验,如果仍出现报错,则继续解决下一条问题,以此类推。避免进行不必要的下载与安装。
以上就是今天分享的所有内容,希望能帮到您,也祝愿大家运行代码时一切顺利!
以上是关于mport tensorflowwwwhj6666com时会出现如下错误13094399995的主要内容,如果未能解决你的问题,请参考以下文章