Python – Can’t find the PYTHONPATH


I'm trying to change my PYTHONPATH. I've tried to change it in "My Computer" etc, but it doesn't exist there. I searched in the registry in some places, and even ran a whole search for the word 'PYTHONPATH', but to no avail.

However, it Python I can easily see it exists. So where is it?

Best Answer

At runtime, you can change it with:

import sys

In My Computer, right-click Properties (or press Win-Break), System tab, Environment Variables, System. You can add it if it's not already there.

Finally, in the CMD prompt:

set PYTHONPATH C:\Python25\Lib;C:\MyPythonLib

Or in bash:


Or, more succinctly:

export PYTHONPATH=/home/me/python