GPU tensorflow安装问题

我是Ubuntu的新用户,我花了一个多星期的时间尝试安装gpu tensorflow.我试着按照网站和博客上的教程进行操作.但每当我在
python控制台中导入tensorflow时.它总是显示:

import tensorflow
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcublas.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcudnn.so.5.1.5 locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcufft.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:119] Couldn't open CUDA   library libcuda.so.1. LD_LIBRARY_PATH:   :/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64
I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:165] hostname: HanGuo
I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:189] libcuda reported version is: Not found: was unable to find libcuda.so DSO loaded into this program
I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:193] kernel reported version is: Permission denied: could not open driver version path for reading: /proc/driver/nvidia/version
I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1091]  LD_LIBRARY_PATH: :/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64
I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1092] failed to find libcuda.so on this system: Failed precondition: could not dlopen DSO: libcuda.so.1; dlerror: libnvidia-fatbinaryloader.so.367.57: cannot open shared object file: No such file or directory
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcurand.so.8.0 locally

我试图在谷歌搜索答案,但还没有真正的解决方案.任何人都可以帮助我吗?

最佳答案 根据$ls /usr/local/cuda的输出,您已成功安装它.

现在,缺少的是PATH定义,以便TensorFlow可以找到它的位置.

1)打开你的.bashrc文件:gedit~ / .bashrc

2)将以下两行附加到文件末尾:

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/include"  
export CUDA_HOME=/usr/local/cuda

3)保存并关闭文本文件后,您可以返回到原始终端并键入此命令以重新加载.bashrc文件:

source ~/.bashrc

虽然第三部分应该照顾,如果你想100%确定它将工作重启计算机.

现在,对于TensorFlow,请记住将CUDA路径设置为/usr/local/cuda,将版本设置为8.0.

点赞