tensorflow 中的一些坑
June 14, 2024
650
Tensorflow 安装之后无法使用 GPU,但是 Pytorch 可以
有错误提示:1
tensorflow/core/common_runtime/gpu/gpu_device.cc:2251] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
原因是 Tensorflow 无法使用 cudnn 的库,找个安装了 Pytorch 的环境,导出其中的 cudnn 路径:1
2export CUDNN_PATH=~/miniconda3/envs/sd/lib/python3.12/site-packages/nvidia/cudnn
export LD_LIBRARY_PATH="$CUDNN_PATH/lib":$LD_LIBRARY_PATH
之后测试通过:1
2import tensorflow as tf
print(tf.test.is_gpu_available())
- 本文作者:EnableAsync
- 本文链接:https://enableasync.github.io/uncategorized/tensorflow/index.html
- 版权声明:本博客所有文章均采用 BY-NC-SA 许可协议,转载请注明出处!