ubuntu下tensorflow 报错 libcusolver.so.8.0: cannot open shared object file: No such file or directory

时间:2021-09-08 21:56:43

解决方法1. 在终端执行:

export LD_LIBRARY_PATH=”$LD_LIBRARY_PATH:/usr/local/cuda/lib64”
export CUDA_HOME=/usr/local/cuda 

但是每次要运行tensorflow时都得执行此命令,而且在Spyder、jupyter notebook中仍然报错。

 

解决方法2.  在bashrc中写入路径:

sudo vim ~/.bashrc
export LD_LIBRARY_PATH=”$LD_LIBRARY_PATH:/usr/local/cuda/lib64”
export CUDA_HOME=/usr/local/cuda
source ~/.bashrc

但是这还没解决我的问题。

 

解决方法3. 彻底解决

  • 检查LD_LIBRARY_PATH
echo $LD_LIBRARY_PATH

我的结果: ”:/usr/local/cuda/lib64”

再执行命令:

sudo ldconfig /usr/local/cuda/lib64

问题完美解决,此时不管在终端、Spyder、jupyter notebook中 import tensorflow、import keras都不报错。

 

export LD_LIBRARY_PATH=”$LD_LIBRARY_PATH:/usr/local/cuda/lib64”
export CUDA_HOME=/usr/local/cuda