天天看點

Python檢視電腦的GPU型号

step1: 安裝pynvml

pip install pynvml
           

step2:

import pynvml
pynvml.nvmlInit()

deviceCount = pynvml.nvmlDeviceGetCount()
for i in range(deviceCount):
    handle = pynvml.nvmlDeviceGetHandleByIndex(i)
    print ("Device", i, ":", pynvml.nvmlDeviceGetName(handle))
           
Python檢視電腦的GPU型号