Windows - editing the PATH environment variable for Python

Background

If you only plan to use GUI applications such as EPD 8 beta, Canopy, or IDLE, then it is not strictly necessary to have any references to Python on your Windows PATH. However in a typical Python workflow, you might spend considerable time working from a command prompt; in this context, the PATH should refer to whichever Python installation you plan to use from the command prompt.

Normally, the PATH will be set during installation when appropriate. However, there are several situations in which you may want to modify the Windows PATH environment variable:

  • You may want to switch which Python version you are using from the command prompt. At any given time, you should only have references to one Python installation on the PATH. So, for example, you should not have simultaneous references to Python27 and Python32 on the PATH.
  • EPD 7.3 sets the Windows PATH correctly during a normal installation. However it is possible, due to conflict with other Python installations or other software, that your PATH might be set incorrectly in an EPD 7.3 installation.
  • EPD 8 beta GUI does not touch the Windows PATH, because as a GUI, it does not need to use the PATH and we do not want to interfere with any other Python installations (including any pre-existing EPD 7.x). However EPD 8 beta does offer you the option of installing Python 7.3 as a "user Python environment" within the GUI, and you might wish to set the Windows PATH in order to also use this same EPD 7.3 from a Windows command prompt.

 

Action

For a typical installation of Python 2.7, you should have the following directories (or equivalent) in the PATH user environment variable:
;C:\Python27;C:\Python27\Scripts

Editing the Windows PATH through the Control Panel (System / Advanced / Environment / User) is awkward and error-prone. We recommend using a utility such as the free Rapid Environment Editor (careful - big download buttons include bloatware; use small download links), to back up your existing PATH settings, modify them, and/or switch between different PATH settings.

Have more questions? Submit a request

Comments

  • Avatar
    Prashant Agrawal

    Is there some way to change PATH in Windows from the command line? I think there is a 'setx' command but that probably takes effect only after a reboot.

  • Avatar
    Jonathan March

    @Prashant: Good tip for experienced command line users. In Windows 7 (and, I expect, Vista), setx affects any subsequently opened command sessions even without a reboot. Windows XP  does not ship with setx. When editing the PATH manually with setx, be sure to check for and remove any conflicting path information (vs simply appending the new path). See setx documentation.

Powered by Zendesk