在同一conda环境下先装Pytroch后装TensorFlow

环境信息:

windows10

NIVDIA CUDA:11.6

python: 3.9

CUDNN:8.3

自己先在上述环境装了pytorch_1.11.0 + cuda_11.3

后因需求继续安装了tensorflow_gpu-2.9.0

在官网https://www.tensorflow.org/install/pip#windows按说明下载Python 3.9 GPU support安装包https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-2.9.0-cp39-cp39-win_amd64.whl,利用pip install tensorflow_gpu-2.9.0-cp39-cp39-win_amd64.whl安装上。

装完执行测试语句

python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"

报错 Could not load dynamic library 'cudnn64_8.dll'; dlerror: cudnn64_8.dll not found:

W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudnn64_8.dll'; dlerror: cudnn64_8.dll not found

W tensorflow/core/common_runtime/gpu/gpu_device.cc:1850] 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.

Skipping registering GPU devices...

报错原因:之前装CUDNN,可能是新版安装包是exe包而不是压缩包(也可能是没下压缩包),直接把bin、lib、include装在了C:\Program Files\NVIDIA\CUDNN\v8.3下,没有把CUDNN的bin、lib、include目录中的文件移动到CUDA对应的目录中。

移动后没问题了。

你可能感兴趣的:(Python,tensorflow,conda,深度学习)