一招解决:tensorflow.config.list_physical_devices("GPU")= []
一、解决
# 使用conda安装 # 使用conda查找可用tensorflow conda search tensorflow # 从Build中查找与自己python环境一致的tensorflow库,其中Build中要包含gpu,如cpu_py310hd1aba9c_0 ,则是gpu版本的tensorflow,适用py3.10 # 安装 conda install tensorflow=2.12.0=gpu_py310hfda07e1_0 # 安装完成
二、验证
# 进入具有GPU卡的主机 python >> import tensorflow >> tensorflow.config.list_physical_devices("GPU") [PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU'), PhysicalDevice(name='/physical_device:GPU:1', device_type='GPU'), PhysicalDevice(name='/physical_device:GPU:2', device_type='GPU'), PhysicalDevice(name='/physical_device:GPU:3', device_type='GPU'), PhysicalDevice(name='/physical_device:GPU:4', device_type='GPU'), PhysicalDevice(name='/physical_device:GPU:5', device_type='GPU'), PhysicalDevice(name='/physical_device:GPU:6', device_type='GPU'), PhysicalDevice(name='/physical_device:GPU:7', device_type='GPU')]
解决!
有问题欢迎讨论