To ensure that a GPU version TensorFlow process only runs on CPU:
import os
os.environ["CUDA_VISIBLE_DEVICES"]="-1"
import tensorflow as tf
For more information on the CUDA_VISIBLE_DEVICES
, have a look to this answer or to the CUDA documentation.