问题描述
在我的 Ubuntu 14.04 上,我使用pip"安装了 tensorflow,如 Tensorflow 安装说明中所述 并且我通过在 python 中导入它来确保它正常工作并且它确实有效.
On my Ubuntu 14.04, I have installed tensorflow, using "pip", as specified in the Tensorflow Installation instructions and I made sure it was working by importing it in python and it did work.
然后,我安装了 Anaconda,它通过向其中添加以下行来更改我的 .bashrc 文件:
Then, I installed Anaconda and it changed my .bashrc file by adding the following line to it:
export PATH="/home/sonny/anaconda2/bin:$PATH"
但由于这一变化,现在它查看上面的 PATH,其中不包含 tensorflow.现在我无法在我的 python 代码中导入 tensorflow.
But because of this change, now it looks into the PATH above, which doesn't contain tensorflow. now I can't import tensorflow in my python code.
扩展 $PATH 环境变量以使其继续使用 anaconda2 中的所有内容但能够导入tensorflow"的正确方法是什么?
What is the proper way to extend the $PATH environment variable so that it stays using everything from anaconda2 but it becomes able to import "tensorflow"?
推荐答案
我以不同的方式解决了这个问题!我找到了一个将 tensorflow.whl 文件转换为 conda 包的链接,所以我继续使用以下命令安装它:
I solved the problem but in a different way!I found a link where the tensorflow.whl files were converted to conda packages, so I went ahead and installed it using the command:
conda install -c https://conda.anaconda.org/jjhelmus tensorflow
它起作用了,因为 $PATH 指向 anaconda 包,我现在可以导入它!
and it worked, since the $PATH points to anaconda packages, I can import it now!
这篇关于Ubuntu 上的 Tensorflow 和 Anaconda?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!