change environment variable windows command prompt python code example Example: python set windows environment variable os.environ['API_PASSWORD'] = 'secret'