我很久以来一直在尝试解决此问题。在现有的python = 3.5 env(在Anaconda中)进行了许多尝试之后,我删除了它并再次创建了一个新的env,只是为了正确安装具有gpu支持的tensorflow。为此,我按照张量流站点中的建议进行了conda create -n FALL python=3.5
和pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.11.0-cp35-cp35m-win_amd64.whl
的操作,因为我使用的是Windows 10并且安装了Anaconda。安装过程中没有错误。而且我一直在将Cuda 8.0和cuDNN用于其他深度学习实践,没有任何障碍。因此,我可以在激活的环境中键入python
。为了检查tensorflow是否正确安装,我做了import tensorflow as tf
并得到了
Traceback (most recent call last):
File "C:\Users\username\Anaconda3\envs\FALL\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\username\Anaconda3\envs\FALL\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\username\Anaconda3\envs\FALL\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\username\Anaconda3\envs\FALL\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\username\Anaconda3\envs\FALL\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\username\Anaconda3\envs\FALL\lib\site-packages\tensorflow\__init__.py", line 22, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Users\username\Anaconda3\envs\FALL\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\username\Anaconda3\envs\FALL\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\username\Anaconda3\envs\FALL\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\username\Anaconda3\envs\FALL\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\username\Anaconda3\envs\FALL\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\username\Anaconda3\envs\FALL\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\username\Anaconda3\envs\FALL\lib\imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.
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 :(得分:0)
不确定您是否仍在寻找要解决的问题,但是由于过去几天我一直在与这个问题作斗争,所以我想在这里留下两分钱,以防万一它有助于任何人前进。
首先要注意的是,我不是通过anaconda安装tensorflow,而是通过python virtualenv中的pip安装。我希望使用anaconda或仅使用pip即可解决该问题。
最后我真的发现我以不兼容的版本安装了一个或多个用于tensorflow的程序。
在撰写本文时,tensorflow-gpu要求使用CUDA 9.0,CUPTI(应随CUDA安装附带)和cuDNN版本大于7.2(但请注意,此版本应与您的特定CUDA安装兼容) 。我的问题是我不经意地使用了CUDA 10.0,我认为它在理论上与tensorflow-gpu兼容(基于粗略搜索,它似乎对某些人有用),但对我根本不起作用。
长话短说,这正是为我工作的设置/过程:
CUDA兼容GPU(https://developer.nvidia.com/cuda-gpus专门检查您的
python 3.5.4
tensorflow-gpu版本1.12.0
CUDA 9.0
所有这些导入张量流对我来说一切正常。
老实说,我希望这对外面的人有帮助,因为这个过程对我个人而言非常艰巨,我希望能够减轻别人的负担。