nvidia-smi
The following content appears. There is only graphics card No. 0
import os os.environ["CUDA_VISIBLE_DEVICES"] = "0"
That's it! ! ! !