Popular recipes tagged "environment" but not "stack"http://code.activestate.com/recipes/tags/environment-stack/2011-03-31T18:27:57-07:00ActiveState Code RecipesManage environment variables on Windows (Python)
2011-03-31T18:27:57-07:00Sridhar Ratnakumarhttp://code.activestate.com/recipes/users/4169511/http://code.activestate.com/recipes/577621-manage-environment-variables-on-windows/
<p style="color: grey">
Python
recipe 577621
by <a href="/recipes/users/4169511/">Sridhar Ratnakumar</a>
(<a href="/recipes/tags/environment/">environment</a>, <a href="/recipes/tags/pywin32/">pywin32</a>, <a href="/recipes/tags/windows/">windows</a>).
Revision 7.
</p>
<p>This recipe facilitates getting and setting of both "user" and "system" environment variables on Windows. It uses PyWin32 (included in ActivePython) ... and works on both Python 2 and Python 3.</p>
Adding the directory of the python executable to the system PATH under windows (Python)
2010-05-19T19:01:31-07:00Anthon van der Neuthttp://code.activestate.com/recipes/users/2403822/http://code.activestate.com/recipes/577233-adding-the-directory-of-the-python-executable-to-t/
<p style="color: grey">
Python
recipe 577233
by <a href="/recipes/users/2403822/">Anthon van der Neut</a>
(<a href="/recipes/tags/environment/">environment</a>, <a href="/recipes/tags/executable/">executable</a>, <a href="/recipes/tags/path/">path</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/variable/">variable</a>).
</p>
<p>If you install python under windows and then open a command shell (DOS-prompt, you normally get an error message
if you type "python" at the prompt. This is because the directory of the python executable is not in the PATH environment variable.
If you know where you installed python, you can add this via Control Panel -> System -> Advanced -> Environment Variables but this is not very user friendly way of doing things and error prone.</p>
<p>This program, if run by double clicking the file or by dragging the file to a command shell, will add the directory of the executable associated with the .py extension to the PATH env. var (if it is not already in there). It will notify other programs of this change, but unfortunately <a href="http://command.com" rel="nofollow">command.com</a> is not smart enough to understand that. You have to open a new command shell after running the program in order to be able to run "python" at the dos prompt.</p>
<p>If run with the optional command line parameter 'remove' the directory will be removed from the PATH.</p>