Popular recipes by Anthon van der Neut http://code.activestate.com/recipes/users/2403822/2010-05-19T19:01:31-07:00ActiveState Code RecipesAdding 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>