报错信息: 1.代码头部添加: import os os.environ["CUDA_VISIBLE_DEVICES"] = "1" 2.限制当前脚本可用显存 gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.333) sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options))