I need to check if an environment variable exists in the system, and add it if not. 
I tried manually deleting the environment variable to test and used os.environ to add the variable:
import os
import site 
loct = site.getsitepackages()
if "OCTAVE_KERNEL_JSON" in os.environ:
    print("OCTAVE_KERNEL_JSON")
else:
    os.environ["OCTAVE_KERNEL_JSON"] = loct[1]+"\octave_kernel\kernel.json"
The code runs without error, but the expected environment variable was not created. Any suggestion?