方法一
import os import torch os.environ["CUDA_VISIBLE_DEVICES"]="4, 5"
方法二
CUDA_VISIBLE_DEVICES=4 python **.py