WIN10+VS2017+TensorFlow-gpu 被坑日记

来源:互联网 发布:淘宝售后在哪评价呢 编辑:程序博客网 时间:2024/05/18 03:23

安装正常来说是肥肠简单的
官方安装:Installing TensorFlow on Windows
一步步的进行没有问题,安装也安装上了,一运行:

import tensorflow as tfTraceback (most recent call last):  File "D:\Program Files\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper    return importlib.import_module(mname)  File "D:\Program Files\Python35\lib\importlib\__init__.py", line 126, in import_module    return _bootstrap._gcd_import(name[level:], package, level)  File "<frozen importlib._bootstrap>", line 986, in _gcd_import  File "<frozen importlib._bootstrap>", line 969, in _find_and_load  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked  File "<frozen importlib._bootstrap>", line 666, in _load_unlocked  File "<frozen importlib._bootstrap>", line 577, in module_from_spec  File "<frozen importlib._bootstrap_external>", line 906, in create_module  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removedImportError: DLL load failed: 找不到指定的模块。During handling of the above exception, another exception occurred:Traceback (most recent call last):  File "D:\Program Files\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>    from tensorflow.python.pywrap_tensorflow_internal import *  File "D:\Program Files\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>    _pywrap_tensorflow_internal = swig_import_helper()  File "D:\Program Files\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper    return importlib.import_module('_pywrap_tensorflow_internal')  File "D:\Program Files\Python35\lib\importlib\__init__.py", line 126, in import_module    return _bootstrap._gcd_import(name[level:], package, level)ImportError: No module named '_pywrap_tensorflow_internal'During handling of the above exception, another exception occurred:

按理说查了一圈,找到网上说出现的问题:
1少cudnn路径(相信你一定下载了并且解压了),加入path即可
2Microsoft Visual C++ 2015 Redistributable Package (x86) 确保有这个
附上链接:http://www.microsoft.com/en-us/download/details.aspx?id=53587
3 python 必须是3.5版本(3.6目前也好使了,亲测可用)
在确保各种路径都加了绝对能找到dll之后,仍然报错
回到官网安装教程再仔细看了一遍发现:

If you have a different version of one of the preceding packages, please change to the specified versions. In particular, the cuDNN version must match exactly: TensorFlow will not load if it cannot find cuDNN64_6.dll. To use a different version of cuDNN, you must build from source.

so,自己的cudnn版本错了,回去检查了下,果然是,重新下载了6.0版本,确实是cuDNN64_6.dll,之后,运行成功

同样tensorflow里面这个问题也列出了我所面临的情况:
https://stackoverflow.com/questions/42011070/on-windows-running-import-tensorflow-generates-no-module-named-pywrap-tenso
遇到问题去网上大部分都在说1,2,3那种问题(汉语博客,当然也首先看汉语),导致浪费了一些时间
哎,仔细阅读官方安装教程才是王道。。。。。

原创粉丝点击