本帖最后由 xzllxls 于 2018-11-10 17:40 编辑
最近新组装了一台电脑,想跑深度学习。
安装了TensorFlow12.0,然而在Python中执行import tensorflow as tf语句时报错。
具体环境:
硬件:Geforce GTX 1070
操作系统:Windows 7 SP1
Python:3.5.3
cuDNN:7.3.1.20(64位)
执行导入语句时报错:
Traceback (most recent call last):
File "D:\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "D:\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "D:\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "D:\Programs\Python\Python35\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "D:\Programs\Python\Python35\lib\imp.py", line 344, in load_dynamic
return _load(spec)
ImportError: DLL load failed with error code -1073741795
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 1, in
File "D:\Programs\Python\Python35\lib\site-packages\tensorflow\__init__.py", line 24, in
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "D:\Programs\Python\Python35\lib\site-packages\tensorflow\python\__init__.py", line 49, in
from tensorflow.python import pywrap_tensorflow
File "D:\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "D:\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "D:\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "D:\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "D:\Programs\Python\Python35\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "D:\Programs\Python\Python35\lib\imp.py", line 344, in load_dynamic
return _load(spec)
ImportError: DLL load failed with error code -1073741795
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
错误提示的意思好像是加载DLL动态链接库的时候出错。
出错之后,检查各种版本和依赖。
1. 安装完成之后,执行PIP list命令查看TensorFlow版本
D:\>PIP list | FINDSTR tensorflow
tensorflow-gpu 1.12.0
tensorflow-tensorboard 0.1.6
2. 检查CUDA和cuDNN的版本、路径及对应的PATH环境变量设置。
CUDA路径:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin
cuDNN路径:D:\PROGRAMS\NVidia\cuDNN\cudnn-9.0-windows7-x64-v7.3.1.20\cuda\bin
查看PATH环境变量:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\libnvvp;C:\Java\jdk1.8.0_191\bin;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVSMI;D:\Program Files\MATLAB\R2015b\runtime\win64;D:\Program Files\MATLAB\R2015b\bin;D:\Program Files\MATLAB\R2015b\polyspace\bin;D:\PROGRAMS\NVidia\cuDNN\cudnn-9.0-windows7-x64-v7.3.1.20\cuda\bin
:\Program Files\CTEX\UserData\miktex\bin;D:\Program Files\CTEX\MiKTeX\miktex\bin;D:\Program Files\CTEX\CTeX\ctex\bin;D:\Program Files\CTEX\CTeX\cct\bin;D:\Program Files\CTEX\CTeX\ty\bin;D:\Program Files\CTEX\Ghostscript\gs9.05\bin;D:\Program Files\CTEX\GSview\gsview;D:\Program Files\CTEX\WinEdt;D:\PROGRAMS\cygwin64\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\extras\CUPTI\libx64;C:\Java\jdk1.8.0_191\jre\bin;D:\Programs\Python\Python35;F:\DLL;C:\Program Files\Common Files\Autodesk Shared\;C:\Program Files (x86)\Autodesk\Backburner\
3. VC++ 2015 Redistributable库也已经安装。
求助一下[名词2],为什么导入的时候会报错呢?原因是在哪里呢?
弄了很长时间,我实在没有找到哪里安装的有问题。
万分感谢!