我正在使用tensorflow CPU一段时间并决定安装tf gpu现在当我尝试导入tf时它给了我这个错误。 我的系统规格是: Intel Xeon w5320 2.8 Ghz 8threads。 10 GB Ram Nvidia GTX 1050 2GB 我为CUDA 9.0安装了最新的驱动程序Cuda 9.0和cuDNN v7.1.3(2018年4月17日)。 任何形式的帮助都表示赞赏。
ImportError Traceback (most recent call last)
C:\Users\Arsalan\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>()
57
---> 58 from tensorflow.python.pywrap_tensorflow_internal import *
59 from tensorflow.python.pywrap_tensorflow_internal import __version__
C:\Users\Arsalan\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in <module>()
17 return importlib.import_module(mname)
---> 18 _pywrap_tensorflow_internal = swig_import_helper()
19 del swig_import_helper
C:\Users\Arsalan\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in swig_import_helper()
16 mname = '.'.join((pkg, '_pywrap_tensorflow_internal')).lstrip('.')
---> 17 return importlib.import_module(mname)
18 _pywrap_tensorflow_internal = swig_import_helper()
C:\Users\Arsalan\Anaconda3\lib\importlib\__init__.py in import_module(name, package)
125 level += 1
--> 126 return _bootstrap._gcd_import(name[level:], package, level)
127
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
<ipython-input-5-fe877e2db533> in <module>()
----> 1 import tensorflow as tf
2 import numpy as np
3 import matplotlib.pyplot as plt
C:\Users\Arsalan\Anaconda3\lib\site-packages\tensorflow\__init__.py in <module>()
22
23 # pylint: disable=wildcard-import
---> 24 from tensorflow.python import * # pylint: disable=redefined-builtin
25 # pylint: enable=wildcard-import
26
C:\Users\Arsalan\Anaconda3\lib\site-packages\tensorflow\python\__init__.py in <module>()
47 import numpy as np
48
---> 49 from tensorflow.python import pywrap_tensorflow
50
51 # Protocol buffers
C:\Users\Arsalan\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>()
72 for some common reasons and solutions. Include the entire stack trace
73 above this error message when asking for help.""" % traceback.format_exc()
---> 74 raise ImportError(msg)
75
76 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long
ImportError: Traceback (most recent call last):
File "C:\Users\Arsalan\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Arsalan\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Arsalan\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\Arsalan\Anaconda3\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_problems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
答案 0 :(得分:1)
以下脚本帮助我查明了在Windows上安装Tensorflow GPU时出现的问题:https://gist.github.com/diarabit/17d9051f9505c9d554d8a7d0c2bc4eb1
我希望这对你也有帮助。
最好的问候。
答案 1 :(得分:1)
https://github.com/rohit-patel/Install_Instructions-Win10-Deeplearning-Keras-Tensorflow 我精确地遵循了这篇文章并让它发挥作用。 实际问题是我没有带AVX的CPU,我需要安装具有兼容CUDA和cudNN的tensorflow 1.5。 我希望它能解决每个人的问题。 感谢。