【问题标题】:Installing and Using Tensorflow GPU安装和使用 TensorFlow GPU
【发布时间】:2019-11-22 11:41:34
【问题描述】:

我在安装 tensorflow-gpu 时尝试了多种资源。我有一张 GeForce GTX 1060 3GB 的显卡。我安装了 CUDA 和 CuDNN 10.0 并根据指南设置了路径。但是,我不能使用 tensorflow-gpu。每当我试图检查它是否有 gpu 时,它都会给我一个错误。你们中是否有人拥有你们遵循的最佳资源或任何建议?

#1st way of checking
>>> import tensorflow as tf
>>> tf.Session()
2019-11-22 18:29:44.166767: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
<tensorflow.python.client.session.Session object at 0x000002855CF70888>

#2nd way of checking    
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())

[name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 3258227305323620158
]

【问题讨论】:

    标签: python tensorflow


    【解决方案1】:

    我遵循了https://www.tensorflow.org/install/pip 的官方安装指南

    在安装 tensorflow-gpu 之前,您可能需要卸载任何现有的 tensorflow (CPU) 软件包

    如果您还没有重新启动,请尝试重新启动,看看是否能解决任何问题。

    卸载 tensorflow (CPU) 运行:

    pip uninstall tensorflow
    

    如果使用 pip3:

    pip3 uninstall tensorflow
    

    然后安装tensorflow-gpu:

    pip install tensorflow-gpu
    

    pip3:

    pip3 install tensorflow-gpu
    

    我见过有人在卸载 tensorflow 之前卸载了 protobuf,因此您也可以通过运行来试一试:

    pip uninstall protobuf
    

    pip3:

    pip3 uninstall protobuf
    

    【讨论】:

      猜你喜欢
      • 2021-06-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多