问题描述
我正在运行带有anaconda2安装的ubuntu 14.04,并且想将tensorflow与CUDA结合使用.到目前为止,我执行的步骤是:
I am running ubuntu 14.04 with an anaconda2 installation and would like to use tensorflow in combination with CUDA. So far the steps I performed are:
- 安装了CUDA 7.5和cudnn
- 通过DEB软件包安装了tensorflow(GPU版本).请注意,我不想使用tensorflow的conda软件包,因为那不是GPU版本.
- 在路径中添加了Anaconda,CUDA和cudnn.
- 为tensorflow创建了一个conda环境(conda create -n tensorflow python = 2.7)
现在,如果我从终端启动python或IDLE,我可以导入tensorflow,它将找到所有CUDA依赖项,太好了!
Now if I start python or IDLE from the terminal, I can import tensorflow and it will find all the CUDA dependencies, great!
...但是,如果我从同一终端启动ipython或spyder,则运行将tf导入tensorflow"会给我一个冷落的"ImportError:没有名为tensorflow的模块".
...however, if I start ipython or spyder from the same terminal, running "import tensorflow as tf" gives me a cold-hearted "ImportError: No module named tensorflow".
我的问题:如何像在IDLE和python实例中一样,让ipython和spyder查找tensorflow库?
My question: How can I get ipython and spyder to find the tensorflow library just like in an IDLE and a python instance?
推荐答案
要解决您的问题,您可以在此处使用3个选项:
To solve your issue you have 3 options here:
1只是从终端启动间谍程序
1 just start spyder from terminal
2将PATH变量定义从.bash_profile移动到会话初始化脚本
2 move PATH variable definition from .bash_profile to session init scripts
3在spyder的运行配置中复制PATH
3 Duplicate your PATH in spyder's run configuration
这篇关于在Ubuntu 14.04下的spyder中使用Tensorflow/Cuda的GPU安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!