Python os library does not see environment variables in Windows
<p>As you can see on the picture below, I have 'SPARK_HOME' environment variable:</p>

<p><a href="http://i.stack.imgur.com/vARRs.png" rel="nofollow"><img src="http://i.stack.imgur.com/vARRs.png" alt="enter image description here"></a></p>

<p>However I just can't get it through python:</p>

<pre><code>import os
os.environ.get('SPARK_HOME', None)  # returns None
"SPARK_HOME" in os.environ          # returns False
</code></pre>

<p>What am I doing wrong? Operating system is Windows 7
PS: I can get other variables, for example: </p>

<pre><code>spark_home = os.environ.get('PYTHONPATH', None)
print spark_home  # returns correct path
</code></pre>

<p>To get your python start seeing new variables you need to restart your console, not just only <code>ipython notebook</code>!!!</p>

python windows python-2.7 operating-system environment-variables