我安装之后从tensorflow网页上的指示tensorflow,使用以下命令:为什么我不能导入tensorflow
sudo apt-get install python-pip python-dev
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.0rc0-cp27-none-linux_x86_64.whl
sudo pip install --upgrade $TF_BINARY_URL
然后我运行python和类型:
import tensorflow
我得到这些错误信息:
ImportError: libcudart.so.8.0: cannot open shared object file: No such file or directory
Error importing tensorflow. Unless you are using bazel,
you should not try to import tensorflow from its source directory;
please exit the tensorflow source tree, and relaunch your python interpreter
from there.
我有谷歌这个问题,并找到答案像https://github.com/tensorflow/tensorflow/issues/1244 和 https://github.com/NVIDIA/DIGITS/issues/8 但他们都没有帮助我的问题。 我的python版本是2.7.6。我正在安装Linux的纯CPU版本。 当我第一次以上述方式安装tensorflow,它工作正常,我设法运行一些教程示例。但是今天我试图安装anaconda,这是另一个有用的计算工具箱。当我安装它时,我发现没有张量流。所以我再次使用conda安装tensorflow。但是,然后发生上述错误。现在我已经移除了anaconda,并且移除了anaconda添加的环境路径。但导入错误仍未解决。 我对发生了什么感到困惑。谢谢大家的亲切帮助!
这里来了奇怪的事情。正如我在问题中所展示的那样,我确实下载了仅限CPU的版本。但它报告了这个消息。 – pfc
我看到,已更新。 – ben
谢谢您的信息。我检查了python的sys.path。我发现有一个包含张量流的路径“/home/myname/.local/lib”。我不知道它是如何出现在那里的。我认为这是导致Python搜索tensorflow的不正确版本的路径。我可以通过运行“sys.path.remove()”来删除此路径。但是这只能暂时消除路径。你知道我可以永久删除吗?我一直在寻找答案,但还没有找到答案。再次感谢你!!! – pfc