tensorflow ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory
安装tf和cuda cudnn套装的时候,安装好后,pycharm运行总是提示找不到lib*等相关库,在stackover flow和quaro查找了好半天,总算是解决了。主要是cuda的动态连接库的path的问题,pycharm找不到cuda相关库文件。直接在/etc/ld.so.conf 中将cuda安装文件夹下的的lib64和lib路径加进去,即可解决问题。
I have find the reason is ldconf, ldconfig is a dynamic link library management command whose purpose is to allow the dynamic link library to be usedby the system.
The default ldconf only search /lib and /usr/lib, as well as the library file under the directory listed in the configuration file /etc/ld. so. conf.
so all of this is caused by the dynamic library of CUDA in the installed CUDA path such as : /path/cuda-9.0/lib64 or /path/cuda-9.0/lib. (for eample my CUDA is installed in /usr/local/cuda-9.0)
if you install the CUDA manual, then after install, you should add the path of cuda/lib64 to /etc/ld.so.conf file
sudo echo "/usr/local/cuda-9.0/lib64/" >> /etc/ld.so.conf
then
sudo ldconfig
of course , you can add the path manual, like:
vim /etc/ld.so.conf
then add the path '/usr/local/cuda-9.0/lib64' at the end.
sudo ldconfig
after the operation, reopen the ipython or pycharm ,
import tensorflow as tf
wow, you will enjoy it!
if you install the CUDA by command such as 'dpkg -i cuda-repo-ubuntu1604_9.0.176-1_amd64.deb' or others,
it may add the cuda lib path to the /etc/ld.so.conf automatically .
but to be on the safe side, check the /etc/ld.so.conf and see if the path add to it .