我的环境如下:
Windows11 、Ubuntu 22.04.3 LTS(WSL2)、pytorch 1.12.1、cuda116
Bug描述:
Could not load library libcudnn_cnn_infer.so.8.
Error: libcuda.so: cannot open shared object file: No such file or directory
解决方法:
执行以下代码,把对应的文件路径添加到.bashrc文件即可:
export LD_LIBRARY_PATH=/usr/lib/wsl/lib:$LD_LIBRARY_PATH
注意:你应该确保你的library所在的位置和上面代码中的“/usr/lib/wsl/lib”对的上,
可以使用以下代码查看你的library所在的位置:
ldconfig -p | grep cuda
以上解决方法参考自:
Libcudnn_cnn_infer.so.8 library can not found - PyTorch Forums