【发布时间】:2019-05-17 00:36:54
【问题描述】:
我已经使用pip install tensorflow 成功安装了 tensorflow,并且一切正常。
我也可以使用pip install tensorflow-gpu 成功安装 tensorflow-gpu,但我无法在我的 python 脚本中导入它:
import tensorflow-gpu
File "<stdin>", line 1
import tensorflow-gpu
^
SyntaxError: invalid syntax
我已经安装了 CUDA v9.0 并运行 windows 10
【问题讨论】:
-
你不需要导入tensorflow-gpu,如果你安装好了
cuda和cudnn,你就可以从tensorflow访问gpu了。 -
但是我怎样才能确保 tensorflow 使用我的 gpu?你的意思是如果我在我的脚本中导入 tensorflow 会自动使用我的 gpu?
-
stackoverflow.com/questions/38559755/… 看哪个GPU的tf知道,除非明确定义,否则会使用GPU(如果可能的话)。
-
当我执行
device_lib.list_local_devices()时我的gpu没有出现我可能因为我在虚拟环境中而找不到我的gpu?
标签: python python-3.x tensorflow