Posted in Python onFebruary 06, 2020
安装TensorFlow后,在Python中输入 import tensorflow as tf 时 提示一下类似错误
ImportError: libcusolver.so.*.0: cannot open shared object file: No such file or directory
libcusolver.so..0 ( 代表某一版本)
解决办法:
1. 输入下面命令,查找libcusolver.so 相关文件的目录
locate libcusolver.so.9
2. 输入下面命令 , 将缺失文件的目录添加到环境变量中。
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda-9.0/lib64" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda-8.0/lib64"
输入python , import tf 如果依然缺失文件,重复 1. 2.
然后
locate libcudnn.so.7
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/cudnn/cudnn-v7.0.5-for-cuda8.0/lib64" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/cudnn/cudnn-v5.1/lib64"
最终,成功import tensorflow
如果需要长期保持环境变量有效,要在 .bashrc文件中添加环境变量,如下
# added by Anaconda3 installer export PATH="/home/yourname/anaconda3/bin:$PATH" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda-8.0/lib64" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/cudnn/cudnn-v5.1/lib64"
保存后激活 bashrc文件
source ~/.bashrc
以上这篇tensorflow 环境变量设置方式就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持三水点靠木。
tensorflow 环境变量设置方式
- Author -
星辰大漠声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@