【问题标题】:Use GPU installation of tensorflow/cuda in spyder under ubuntu 14.04ubuntu 14.04下spyder中使用GPU安装tensorflow/cuda
【发布时间】:2016-09-11 05:24:21
【问题描述】:

我正在运行安装了 anaconda2 的 ubuntu 14.04,并希望将 tensorflow 与 CUDA 结合使用。到目前为止,我执行的步骤是:

  1. 已安装 CUDA 7.5 和 cudnn
  2. 通过 DEB 包安装了 tensorflow(GPU 版本)。请注意,我不想使用 tensorflow 的 conda 包,因为它不是 GPU 版本。
  3. 将 Anaconda、CUDA 和 cudnn 添加到路径。
  4. 为 tensorflow 创建了 conda 环境(conda create -n tensorflow python=2.7)

现在,如果我从终端启动 python 或 IDLE,我可以导入 tensorflow,它会找到所有 CUDA 依赖项,太棒了!

...但是,如果我从同一个终端启动 ipython 或 spyder,运行“import tensorflow as tf”会给我一个冷酷的“ImportError: No module named tensorflow”。

我的问题:如何让 ipython 和 spyder 像在 IDLE 和 python 实例中一样找到 tensorflow 库?

【问题讨论】:

  • 你确定他们使用的是同一个python环境吗?
  • Spyder 指向 ~/anaconda2/bin/python 作为其 python 可执行文件。我的 tensorflow 安装在 ~/anaconda2/envs/tensorflow/bin 中。好像是同一个环境?还是我错过了什么?
  • 更新。好的,我想我明白了。所以显然在 tensorflow 环境中,我能够再次安装 ipython,现在它确实可以识别 tensorflow。不过,同样的技巧并没有解决 spyder 的问题。
  • 你的 tensorflow 环境中安装了 spyder 和 ipython 吗? source activate tensorflow && conda list 的输出是什么?

标签: python anaconda tensorflow spyder


【解决方案1】:

要解决您的问题,您有 3 个选项:

1 从终端启动 spyder

2 将 PATH 变量定义从 .bash_profile 移动到会话初始化脚本

3 在 spyder 的运行配置中复制你的 PATH

【讨论】:

    猜你喜欢
    • 2019-06-04
    • 1970-01-01
    • 1970-01-01
    • 2017-02-10
    • 2019-01-03
    • 1970-01-01
    • 1970-01-01
    • 2016-02-24
    • 1970-01-01
    相关资源
    最近更新 更多