Python: 无法导入TensorFlow-GPU。

3

我按照此链接介绍的步骤,在我的电脑上使用Anaconda3成功创建了TensorFlow环境。但是当我尝试执行以下操作时:

>>> import tensorflow as tf

我收到了以下错误消息:OSError和ImportError。
Traceback (most recent call last):
  File "C:\Users\Froilan\Anaconda3\envs\tensorflow\lib\site-
packages\tensorflow\python\platform\self_check.py", line 75, in preload_check
ctypes.WinDLL(build_info.cudart_dll_name)
  File "C:\Users\Froilan\Anaconda3\envs\tensorflow\lib\ctypes\__init__.py", line 351, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] This 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\Froilan\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import *
  File "C:\Users\Froilan\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
  File "C:\Users\Froilan\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 30, in <module>
self_check.preload_check()
  File "C:\Users\Froilan\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\platform\self_check.py", line 82, in preload_check
% (build_info.cudart_dll_name, build_info.cuda_version_number))
ImportError: Could not find 'cudart64_80.dll'. TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. Download and install CUDA 8.0 from this URL: https://developer.nvidia.com/cuda-toolkit

这可能与我的CPU有关吗?我使用的是Ryzen 1700。 + GPU:GTX 1050 Ti-比1080 ti等略逊一筹..但我听说GPU仍然比CPU好得多。


你想使用CPU还是GPU? - Vadim
请问您使用的是哪款GPU? - Vadim
我想使用GPU版本--我的是GTX 1050 ti。 - HyeongGyu Froilan Choi
好的,请检查我的答案,显然你没有安装或设置CUDA库。 - Vadim
1个回答

3

Erp.. 我想那是针对 Linux 的..? 我用的是 Windows 10。或者有没有办法实现呢?抱歉,我对操作系统、bash 等都很新手.. :( - HyeongGyu Froilan Choi
好的,非常感谢。但是还有一个问题有点不相关...在CUDA 8.0安装过程中,我的机器无法识别我的第二个显示器。这正常吗? - HyeongGyu Froilan Choi
我怕这次谷歌帮不了我...无论如何,我会尽力找出问题所在。非常感谢。 - HyeongGyu Froilan Choi
1
好的,问题解决了。 对于那些可能遇到类似问题的人: 检查您的GPU驱动程序。更新它,重新启动您的机器。 - HyeongGyu Froilan Choi

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接