Keras : switch backend in Notebook
You can set the environment variable via python's built in os module.

import os

os.environ["KERAS_BACKEND"] = "tf"   # or theano


Making changes in one notebook does not seem to carry over to other notebooks that are started in the same Jupyter session (run from a single terminal).

Here I try to get the environment variable in notebook 2, and we see it doesn't exist:


Create environment variable in Notebook 1:

Now make the changes in notebook 1 (after also confirming that the environment variable didn't exist - we catch the exception)



And now go back to notebook 2 to see if it picks up on the changed value:





There are also settings that should be read by Keras on import. Have a look at the documentation. If you are on windows, there are some separate steps you should check out there.