为什么我不能导入tensorflow
Why can't I import 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.
我遇到了 google 这个问题并找到了类似 https://github.com/tensorflow/tensorflow/issues/1244 的答案
和
https://github.com/NVIDIA/DIGITS/issues/8
但是其中 none 对我的问题有帮助。
我的 python 是 2.7.6 版本。我正在为 Linux 安装 CPU-only 版本。
当我第一次以上述方式安装 tensorflow 时,它工作正常并且我设法 运行 一些教程示例。但是今天我尝试安装 anaconda,这是另一个有用的计算工具箱。安装的时候发现没有tensorflow了。所以我再次使用 conda 安装了 tensorflow。但是随后发生了上述错误。现在我已经把anaconda去掉了,把anaconda添加的环境路径也去掉了。但导入错误仍未解决。
我对发生的事情感到困惑。谢谢大家的帮助!!!
ImportError: libcudart.so.8.0: cannot open shared object file: No such file or directory
这表明正在导入GPU版本的tensorflow。也许你安装了另一个版本的tensorflow?如果您使用 pip 安装了所有 python 包,您可以通过列出已安装的包进行检查。
在/etc/ld.so.conf.d/:
中创建.conf文件
sudo nano /etc/ld.so.conf.d/nvidia.conf
添加这个:
/usr/local/cuda-8.0/lib64
/usr/local/cuda-8.0/lib # you probably don't need this line; check
# if the directory exists
然后运行sudo ldconfig
。希望这能给你带来快乐。
我按照 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.
我遇到了 google 这个问题并找到了类似 https://github.com/tensorflow/tensorflow/issues/1244 的答案 和 https://github.com/NVIDIA/DIGITS/issues/8 但是其中 none 对我的问题有帮助。 我的 python 是 2.7.6 版本。我正在为 Linux 安装 CPU-only 版本。 当我第一次以上述方式安装 tensorflow 时,它工作正常并且我设法 运行 一些教程示例。但是今天我尝试安装 anaconda,这是另一个有用的计算工具箱。安装的时候发现没有tensorflow了。所以我再次使用 conda 安装了 tensorflow。但是随后发生了上述错误。现在我已经把anaconda去掉了,把anaconda添加的环境路径也去掉了。但导入错误仍未解决。 我对发生的事情感到困惑。谢谢大家的帮助!!!
ImportError: libcudart.so.8.0: cannot open shared object file: No such file or directory
这表明正在导入GPU版本的tensorflow。也许你安装了另一个版本的tensorflow?如果您使用 pip 安装了所有 python 包,您可以通过列出已安装的包进行检查。
在/etc/ld.so.conf.d/:
中创建.conf文件sudo nano /etc/ld.so.conf.d/nvidia.conf
添加这个:
/usr/local/cuda-8.0/lib64
/usr/local/cuda-8.0/lib # you probably don't need this line; check
# if the directory exists
然后运行sudo ldconfig
。希望这能给你带来快乐。