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

标签 python tensorflow cuda windows-10 anaconda

我在安装 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

最佳答案

这类似于 Tensorflow import error

快速回答:默认情况下,NVidia 将安装最新版本的 CUDA,目前为 9.1

TensorFlow 预计为 9.0,如“ImportError: Could not find 'cudart64_90.dll'”所示 - 将其读取为 cuda-runtime-64-bit-version9.0 DLL

要解决此问题,请前往 NVidia 网站下载 9.0 版本的驱动程序,然后就可以开始使用了。我在这里写了一个指南:http://www.laurencemoroney.com/installing-tensorflow-with-gpu-on-windows-10/

关于python - 在 Windows 10 上使用 CUDA 9.1 和 Python 3.6 安装 Tensorflow,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49245642/

相关文章:

python - python aiohttp.web 中间件如何工作

python - 使用 Debian 8 VirtualBox 安装 Tensorflow 的 Anaconda 失败

python-3.x - 如何将 tf.estimator 转换为 keras 模型?

python - tensorflow 中的分类器根据标签大小返回错误

c++ - cudaMemcpy 之后数组的值

用于匹配多词名称的 Python 正则表达式

c++ - boost 类的 Python 绑定(bind) vector

python - Jinja 2 中列表的总和元素

运行 "CUDA By Example"julia_gpu.cu 时出现 CUDA 错误

matrix - 使用 CUDA 计算数百个小矩阵的特征值/特征向量