from tensorflow.python.client import device_lib print(device_lib.list_local_devices()) 运行在pycharm IDE下面