Find your python path (Windows)

To find your python path type the following in the interpreter

import sys, pprint
pprint.pprint(sys.path)

This returns a list of places where python will look for modules, so you can save a module in any of these places(although you should create your own folder and add this to your path for any modules you create) and import a module using import.
['',
'C:\\Python27\\Lib\\idlelib',
'C:\\my_python_modules',
'C:\\WINDOWS\\system32\\python27.zip',
'C:\\Python27\\DLLs',
'C:\\Python27\\lib',
'C:\\Python27\\lib\\plat-win',
'C:\\Python27\\lib\\lib-tk',
'C:\\Python27',
'C:\\Python27\\lib\\site-packages',
'C:\\Python27\\lib\\site-packages\\wx-2.8-msw-unicode']

As you can see I've added C:\\my_python_modules to my windows path.

Tags: