首页 > 解决方案 > win10上的tensorflow-gpu安装问题

问题描述

虽然我安装了 tensorflow-gpu 2.2.0 包括

tf-gpu 2.2.0 cuda 10.1 cudnn 7.6.5 用于 cuda 10.1 nvidia GTX 1060 驱动程序 426.00

并满足以下错误回溯

Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
2020-07-18 17:38:28.372375: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
>>> tf.constant(2)
2020-07-18 17:38:34.134478: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
2020-07-18 17:38:35.100957: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1561] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce GTX 1060 computeCapability: 6.1
coreClock: 1.6705GHz coreCount: 10 deviceMemorySize: 6.00GiB deviceMemoryBandwidth: 178.99GiB/s
2020-07-18 17:38:35.114601: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
2020-07-18 17:38:35.126682: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_10.dll
2020-07-18 17:38:35.137879: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_10.dll
2020-07-18 17:38:35.146739: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_10.dll
2020-07-18 17:38:35.157400: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_10.dll
2020-07-18 17:38:35.166308: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusparse64_10.dll
2020-07-18 17:38:35.237584: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
2020-07-18 17:38:35.296525: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1703] Adding visible gpu devices: 0
2020-07-18 17:38:36.129494: I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2020-07-18 17:38:38.755854: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x29083724780 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-07-18 17:38:38.764397: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2020-07-18 17:38:39.008813: F tensorflow/stream_executor/lib/statusor.cc:34] Attempting to fetch value instead of handling error Internal: failed to get device attribute 13 for device 0: CUDA_ERROR_UNKNOWN: unknown error

标签: pythontensorflow

解决方案


解决此问题的最佳方法是降级到tensorflow 2.0. 但您也可以尝试以下方法:

创建一个新的conda environment with python 3.x并安装必要的库。

为了将来使用,请检查您的 python 是否已添加到路径变量中。

从这里安装 Visual Studio 2015-2019 x86 和 x64:https: //support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads(这在大多数情况下也有效)

请注意代码错误中的这一行: Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2


推荐阅读