在Windows上导入Tensorflow时出错

时间:2017-12-29 11:39:14

标签: python tensorflow

我在尝试导入张量流时遇到此错误:

Traceback (most recent call last):
  File "C:\Users\Luca\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\platform\self_check.py", line 75, in preload_check
    ctypes.WinDLL(build_info.cudart_dll_name)
  File "C:\Users\Luca\AppData\Local\Programs\Python\Python36\lib\ctypes\ \__init__.py", line 348, in \__init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] Impossibile trovare il modulo specificato

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    import tensorflow as tf
  File "C:\Users\Luca\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "C:\Users\Luca\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Users\Luca\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 30, in <module>
    self_check.preload_check()
  File "C:\Users\Luca\AppData\Local\Programs\Python\Python36\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

我已尝试卸载protobuf和tensorflow并重新安装,但仍然出现此错误。

这些是我的规格:

操作系统:W10

GPU:Nvidia GTX 1050 Ti

有人可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

您是否尝试过从https://developer.nvidia.com/cuda-toolkit

下载Cuda 8.0
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