我一直在我的CPU上运行我的tensorflow程序。但是,它的速度一直很慢,所以我想设置一个gpu环境在我的1070ti上运行它。但是,在下载CUDA 9.0和CUDNN 7.4之后,tensorflow-gpu无法运行它。
每当我尝试在python中导入tensorflow时都会出现错误。我在virtualenv环境中安装了tensorflow,运行的脚本在该文件夹内。
import tensorflow
我得到以下输出:
Traceback (most recent call last):
File "C:\Users\Jimmy\Documents\machinelearning\machinelearning\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Jimmy\Documents\machinelearning\machinelearning\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Jimmy\Documents\machinelearning\machinelearning\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 "C:\Users\Jimmy\Documents\machinelearning\machinelearning\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\Jimmy\Documents\machinelearning\machinelearning\lib\imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Jimmy\Documents\machinelearning\machinelearning\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Users\Jimmy\Documents\machinelearning\machinelearning\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\Jimmy\Documents\machinelearning\machinelearning\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\Jimmy\Documents\machinelearning\machinelearning\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Jimmy\Documents\machinelearning\machinelearning\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Jimmy\Documents\machinelearning\machinelearning\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 "C:\Users\Jimmy\Documents\machinelearning\machinelearning\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\Jimmy\Documents\machinelearning\machinelearning\lib\imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.
答案 0 :(得分:0)
根据此线程:https://github.com/tensorflow/tensorflow/issues/22794
这些版本在Win10上不起作用:
有人说您可以尝试将张量流降级到1.10。
pip install tensorflow-gpu==1.10.0