Skip to main content
 首页 » 编程设计

python之在 Windows 10 上使用 CUDA 9.1 和 Python 3.6 安装 Tensorflow

2024年08月16日28insus

<分区>

我在安装 TensorFlow 时遇到了这个错误。编辑:我安装了 CUDA 9.0,并更改了我的环境变量,包括 Path 变量,现在它可以工作了。

    (tensorflow-gpu) C:\Users\Admin>python 
Python 3.6.4 |Anaconda, Inc.| (default, Mar  9 2018, 07:43:39) [MSC v.1900 64 bit (AMD64)] on win32 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import tensorflow as tf 
Traceback (most recent call last): 
  File "C:\Users\Admin\AppData\Local\conda\conda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\platform\self_check.py", line 75, in preload_check 
    ctypes.WinDLL(build_info.cudart_dll_name) 
  File "C:\Users\Admin\AppData\Local\conda\conda\envs\tensorflow-gpu\lib\ctypes\__init__.py", line 348, in __init__ 
    self._handle = _dlopen(self._name, mode) 
OSError: [WinError 126] 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\Admin\AppData\Local\conda\conda\envs\tensorflow-gpu\lib\site-packages\tensorflow\__init__.py", line 24, in <module> 
    from tensorflow.python import * 
  File "C:\Users\Admin\AppData\Local\conda\conda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module> 
    from tensorflow.python import pywrap_tensorflow 
  File "C:\Users\Admin\AppData\Local\conda\conda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 30, in <module> 
    self_check.preload_check() 
  File "C:\Users\Admin\AppData\Local\conda\conda\envs\tensorflow-gpu\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_90.dll'. TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. Download and install CUDA 9.0 from this URL: https://developer.nvidia.com/cuda-toolkit 

这是一个与这个问题非常相似的问题。

Tensorflow installation with CUDA 9.1 and python 3.6