Editing Windows environment variables through the Control Panel is awkward and error-prone.
We strongly recommend using a friendly utility such as the free Rapid Environment Editor, to back up your existing environment variables and modify or remove them. This great utility makes editing PATH, PYTHONPATH, or other variables that list multiple directories, easy and robust, by displaying each path on a separate line and transparently handling the semicolons between them. (Pro tip: On the Rapid EE download page, don't use the big green ad-ware Download button; use the plain download link for RapidEE_setup.exe.)
Warning about a possible source of confusion: Windows has two levels of environment variables: System and User (not to be confused with the System and User virtual environments in Canopy v1!). You'll usually be working with the User variables.
- In the Rapid Environment Editor, System variables are shown on the left, and User variables are shown on the right.
- System variables apply to all users, and require administrator rights to change. (In Rapid Environment Editor, click the "Restart as administrator" button if you wish to change these.) If you change system variables, you should log out of Windows and then log back in (or just reboot) to ensure that your changes take effect.
- User variables apply only to the current user, who can change them unless prohibited by system configuration rules.
- User environment variables supersede (replace) the same-named System variables when both exist, except for the PATH variable.
- The PATH variable is constructed as the concatenation of the System PATH variable and the User PATH variable, so that the directories specified in the System PATH will always be searched before the directories specified in the User PATH.
- In general, you should not set the PYTHONPATH environment variable at the System level, only at the User level. (As described in this article, the PYTHONPATH environment variable should not be used to point into a Python environment, but only to point to code that is not installed into a Python environment -- typically, your own working code in progress.)
The Windows SETX command can also be used to set either User or System environment variables.
Alternatively, if you are forbidden from installing third-party software on your system and are technically meticulous and patient, then this article on Stack Overflow gives step-by-step instructions for setting PYTHONPATH using the built-in Windows dialogs (System / Advanced / Environment / User).
Make Canopy 2 User Python be your default Python
How do I set PYTHONPATH and other environment variables for Canopy?