用cmd进入安装tf_g20的环境下的python,输入代码检测,如下图所示:
MicrosoftWindows[版本10.0.18362.836](c)2019MicrosoftCorporation。保留所有权利。C:\Users\waws>activatetf_g20(tf_g20)C:\Users\waws>pythonPython3.6.10|Anaconda,Inc.|(default,Mar232020,17:58:33)[MSCv.191664bit(AMD64)]onwin32Type"help","copyright","credits"or"license"formoreinformation.>>>importtensorflowastf2020-05-2109:46:58.142643:Itensorflow/stream_executor/platform/default/dso_loader.cc:44]Successfullyopeneddynamiclibrarycudart64_100.dll>>>print(tf.__version__)2.0.0>>>print(tf.test.is_gpu_available())2020-05-2109:47:58.730470:Itensorflow/core/platform/cpu_feature_guard.cc:142]YourCPUsupportsinstructionsthatthisTensorFlowbinarywasnotcompiledtouse:AVX22020-05-2109:47:58.752614:Itensorflow/stream_executor/platform/default/dso_loader.cc:44]Successfullyopeneddynamiclibrarynvcuda.dll2020-05-2109:47:59.744516:Itensorflow/core/common_runtime/gpu/gpu_device.cc:1618]Founddevice0withproperties:name:GeForceGTX1050major:6minor:1memoryClockRate(GHz):1.493pciBusID:0000:01:00.02020-05-2109:47:59.751721:Itensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25]GPUlibrariesarestaticallylinked,skipdlopencheck.2020-05-2109:47:59.759183:Itensorflow/core/common_runtime/gpu/gpu_device.cc:1746]Addingvisiblegpudevices:02020-05-2109:48:03.133562:Itensorflow/core/common_runtime/gpu/gpu_device.cc:1159]DeviceinterconnectStreamExecutorwithstrength1edgematrix:2020-05-2109:48:03.140510:Itensorflow/core/common_runtime/gpu/gpu_device.cc:1165]02020-05-2109:48:03.143501:Itensorflow/core/common_runtime/gpu/gpu_device.cc:1178]0:N2020-05-2109:48:03.151461:Itensorflow/core/common_runtime/gpu/gpu_device.cc:1304]CreatedTensorFlowdevice(/device:GPU:0with3001MBmemory)->physicalGPU(device:0,name:GeForceGTX1050,pcibusid:0000:01:00.0,computecapability:6.1)True>>>
核心的三个命令:import TensorFlow as tf
、print(tf.__version__)
、print(tf.test.is_gpu_available())
若无报错,且检验gpu返回值为ture,即证明tensorflow2_gpu安装成功