查看TensorFlow的版本以及安装路径
进入到Python环境
import tensorflow as tf
tf.__version__ # 查看版本
tf.__path__ # 查看安装路径
查看TensorFlow版本的另一种方法
sudo pip3 show tensorflow-gpu # GPU版
sudo pip3 show tensorflow # 非GPU版
查看TensorFlow版本的另一种方法
$ python
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from tensorflow.python.client import device_lib
>>> device_lib.list_local_devices()
输出
2019-05-18 21:36:53.492143: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2019-05-18 21:36:53.606863: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:898] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2019-05-18 21:36:53.607366: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties:
name: GeForce MX150 major: 6 minor: 1 memoryClockRate(GHz): 1.341
pciBusID: 0000:01:00.0
totalMemory: 1.96GiB freeMemory: 1.27GiB
2019-05-18 21:36:53.607382: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0
2019-05-18 21:36:53.826350: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-05-18 21:36:53.826381: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929] 0
2019-05-18 21:36:53.826388: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0: N
2019-05-18 21:36:53.826499: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/device:GPU:0 with 1017 MB memory) -> physical GPU (device: 0, name: GeForce MX150, pci bus id: 0000:01:00.0, compute capability: 6.1)
[name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 1057080042639158477
, name: "/device:GPU:0"
device_type: "GPU"
memory_limit: 1067384832
locality {
bus_id: 1
links {
}
}
incarnation: 9801033547599324942
physical_device_desc: "device: 0, name: GeForce MX150, pci bus id: 0000:01:00.0, compute capability: 6.1"
]
另一种方法
查看tensorflow-gpu的版本:
pip list