Fork me on GitHub

解决TensorFlow在terminal中正常但在jupyter notebook中报错的方案

报错情况:

# 本地运行正常,jupyter中无法 import tensorflow
ImportError: libcublas.so.10.0: cannot open shared object file: No such file or directory

  


 

解决方案:

1.在jupyter terminal 中 进入python  import tensorflow as tf  没问题 ,在ipython中执行报

ImportError: libcublas.so.10.0: cannot open shared object file: No such file or directory
查看 对应的 /usr/local/cuda-10.0/lib64 下有 该文件

解决过程

  sudo  vim  ~/.bashrc   加入 如下

export PATH=/usr/local/cuda-10.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

sudo vim  /etc/profile   加入 如下

export PATH=/usr/local/cuda-10.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}export PATH=/usr/local/cuda/bin:$PATH

  

创建链接文件:

  sudo vim /etc/ld.so.conf.d/cuda.conf     可能是个空文件 , 加入 如下 

      /usr/local/cuda/lib64

最后执行

     sudo ldconfig

ipython中再次运行  import tensorflow as tf   通过

参考 https://blog.csdn.net/fdqw_sph/article/details/78745375

posted @ 2019-07-05 00:37  stardsd  阅读(3739)  评论(0编辑  收藏  举报